From e7ece62b96b5323c163063d08edfe881543b8bd0 Mon Sep 17 00:00:00 2001 From: Henry Mercer Date: Fri, 23 Jan 2026 18:41:00 +0000 Subject: [PATCH 01/11] Add feature flag to skip file coverage information on PRs --- lib/analyze-action-post.js | 9 +++++++++ lib/analyze-action.js | 9 +++++++++ lib/autobuild-action.js | 9 +++++++++ lib/init-action-post.js | 9 +++++++++ lib/init-action.js | 26 +++++++++++++++++++++++--- lib/resolve-environment-action.js | 9 +++++++++ lib/setup-codeql-action.js | 9 +++++++++ lib/start-proxy-action-post.js | 9 +++++++++ lib/start-proxy-action.js | 9 +++++++++ lib/upload-lib.js | 9 +++++++++ lib/upload-sarif-action-post.js | 9 +++++++++ lib/upload-sarif-action.js | 9 +++++++++ src/config-utils.test.ts | 1 + src/config-utils.ts | 8 ++++++++ src/feature-flags.ts | 10 ++++++++++ src/init-action.ts | 14 +++++++++++++- src/testing-utils.ts | 1 + 17 files changed, 155 insertions(+), 4 deletions(-) diff --git a/lib/analyze-action-post.js b/lib/analyze-action-post.js index d0e16267ca..2c32861a3d 100644 --- a/lib/analyze-action-post.js +++ b/lib/analyze-action-post.js @@ -124724,6 +124724,15 @@ var featureConfig = { legacyApi: true, minimumVersion: void 0 }, + ["skip_file_coverage_on_prs" /* SkipFileCoverageOnPrs */]: { + defaultValue: false, + envVar: "CODEQL_ACTION_SKIP_FILE_COVERAGE_ON_PRS", + // For testing, this is not behind a CLI version check yet. However + // before rolling this out externally, we should set a minimum version here + // since current versions of the CodeQL CLI will log if baseline information + // cannot be found when interpreting results. + minimumVersion: void 0 + }, ["upload_overlay_db_to_api" /* UploadOverlayDbToApi */]: { defaultValue: false, envVar: "CODEQL_ACTION_UPLOAD_OVERLAY_DB_TO_API", diff --git a/lib/analyze-action.js b/lib/analyze-action.js index 126b0f7ec9..ef704b6ced 100644 --- a/lib/analyze-action.js +++ b/lib/analyze-action.js @@ -91287,6 +91287,15 @@ var featureConfig = { legacyApi: true, minimumVersion: void 0 }, + ["skip_file_coverage_on_prs" /* SkipFileCoverageOnPrs */]: { + defaultValue: false, + envVar: "CODEQL_ACTION_SKIP_FILE_COVERAGE_ON_PRS", + // For testing, this is not behind a CLI version check yet. However + // before rolling this out externally, we should set a minimum version here + // since current versions of the CodeQL CLI will log if baseline information + // cannot be found when interpreting results. + minimumVersion: void 0 + }, ["upload_overlay_db_to_api" /* UploadOverlayDbToApi */]: { defaultValue: false, envVar: "CODEQL_ACTION_UPLOAD_OVERLAY_DB_TO_API", diff --git a/lib/autobuild-action.js b/lib/autobuild-action.js index 2e37724d49..ef2885e7da 100644 --- a/lib/autobuild-action.js +++ b/lib/autobuild-action.js @@ -87620,6 +87620,15 @@ var featureConfig = { legacyApi: true, minimumVersion: void 0 }, + ["skip_file_coverage_on_prs" /* SkipFileCoverageOnPrs */]: { + defaultValue: false, + envVar: "CODEQL_ACTION_SKIP_FILE_COVERAGE_ON_PRS", + // For testing, this is not behind a CLI version check yet. However + // before rolling this out externally, we should set a minimum version here + // since current versions of the CodeQL CLI will log if baseline information + // cannot be found when interpreting results. + minimumVersion: void 0 + }, ["upload_overlay_db_to_api" /* UploadOverlayDbToApi */]: { defaultValue: false, envVar: "CODEQL_ACTION_UPLOAD_OVERLAY_DB_TO_API", diff --git a/lib/init-action-post.js b/lib/init-action-post.js index 272e6ee6f1..fc995b8e63 100644 --- a/lib/init-action-post.js +++ b/lib/init-action-post.js @@ -128119,6 +128119,15 @@ var featureConfig = { legacyApi: true, minimumVersion: void 0 }, + ["skip_file_coverage_on_prs" /* SkipFileCoverageOnPrs */]: { + defaultValue: false, + envVar: "CODEQL_ACTION_SKIP_FILE_COVERAGE_ON_PRS", + // For testing, this is not behind a CLI version check yet. However + // before rolling this out externally, we should set a minimum version here + // since current versions of the CodeQL CLI will log if baseline information + // cannot be found when interpreting results. + minimumVersion: void 0 + }, ["upload_overlay_db_to_api" /* UploadOverlayDbToApi */]: { defaultValue: false, envVar: "CODEQL_ACTION_UPLOAD_OVERLAY_DB_TO_API", diff --git a/lib/init-action.js b/lib/init-action.js index 8dfb854c64..b1100c0fdc 100644 --- a/lib/init-action.js +++ b/lib/init-action.js @@ -88780,6 +88780,15 @@ var featureConfig = { legacyApi: true, minimumVersion: void 0 }, + ["skip_file_coverage_on_prs" /* SkipFileCoverageOnPrs */]: { + defaultValue: false, + envVar: "CODEQL_ACTION_SKIP_FILE_COVERAGE_ON_PRS", + // For testing, this is not behind a CLI version check yet. However + // before rolling this out externally, we should set a minimum version here + // since current versions of the CodeQL CLI will log if baseline information + // cannot be found when interpreting results. + minimumVersion: void 0 + }, ["upload_overlay_db_to_api" /* UploadOverlayDbToApi */]: { defaultValue: false, envVar: "CODEQL_ACTION_UPLOAD_OVERLAY_DB_TO_API", @@ -89334,7 +89343,8 @@ async function initActionState({ features, repositoryProperties, analysisKinds, - logger + logger, + enableFileCoverageInformation }, userConfig) { const languages = await getLanguages( codeql, @@ -89396,7 +89406,8 @@ async function initActionState({ extraQueryExclusions: [], overlayDatabaseMode: "none" /* None */, useOverlayDatabaseCaching: false, - repositoryProperties + repositoryProperties, + enableFileCoverageInformation }; } async function downloadCacheWithTime(trapCachingEnabled, codeQL, languages, logger) { @@ -92626,6 +92637,7 @@ async function run(startedAt) { } } analysisKinds = await getAnalysisKinds(logger); + const debugMode = getOptionalInput("debug") === "true" || core13.isDebug(); config = await initConfig2(features, { analysisKinds, languagesInput: getOptionalInput("languages"), @@ -92642,7 +92654,7 @@ async function run(startedAt) { // - The `init` Action is passed `debug: true`. // - Actions step debugging is enabled (e.g. by [enabling debug logging for a rerun](https://docs.github.com/en/actions/managing-workflow-runs/re-running-workflows-and-jobs#re-running-all-the-jobs-in-a-workflow), // or by setting the `ACTIONS_STEP_DEBUG` secret to `true`). - debugMode: getOptionalInput("debug") === "true" || core13.isDebug(), + debugMode, debugArtifactName: getOptionalInput("debug-artifact-name") || DEFAULT_DEBUG_ARTIFACT_NAME, debugDatabaseName: getOptionalInput("debug-database-name") || DEFAULT_DEBUG_DATABASE_NAME, repository: repositoryNwo, @@ -92654,6 +92666,14 @@ async function run(startedAt) { apiDetails, features, repositoryProperties, + enableFileCoverageInformation: ( + // Always enable file coverage information in debug mode + debugMode || // We're most interested in speeding up PRs, and we want to keep + // submitting file coverage information for the default branch since + // it is used to populate the status page. + !isAnalyzingPullRequest() || // For now, restrict this feature to the GitHub org + repositoryNwo.owner !== "github" || !await features.getValue("skip_file_coverage_on_prs" /* SkipFileCoverageOnPrs */) + ), logger }); await checkInstallPython311(config.languages, codeql); diff --git a/lib/resolve-environment-action.js b/lib/resolve-environment-action.js index 0f6546ca92..e3d81d1400 100644 --- a/lib/resolve-environment-action.js +++ b/lib/resolve-environment-action.js @@ -87611,6 +87611,15 @@ var featureConfig = { legacyApi: true, minimumVersion: void 0 }, + ["skip_file_coverage_on_prs" /* SkipFileCoverageOnPrs */]: { + defaultValue: false, + envVar: "CODEQL_ACTION_SKIP_FILE_COVERAGE_ON_PRS", + // For testing, this is not behind a CLI version check yet. However + // before rolling this out externally, we should set a minimum version here + // since current versions of the CodeQL CLI will log if baseline information + // cannot be found when interpreting results. + minimumVersion: void 0 + }, ["upload_overlay_db_to_api" /* UploadOverlayDbToApi */]: { defaultValue: false, envVar: "CODEQL_ACTION_UPLOAD_OVERLAY_DB_TO_API", diff --git a/lib/setup-codeql-action.js b/lib/setup-codeql-action.js index 914aad87da..79711e8204 100644 --- a/lib/setup-codeql-action.js +++ b/lib/setup-codeql-action.js @@ -87523,6 +87523,15 @@ var featureConfig = { legacyApi: true, minimumVersion: void 0 }, + ["skip_file_coverage_on_prs" /* SkipFileCoverageOnPrs */]: { + defaultValue: false, + envVar: "CODEQL_ACTION_SKIP_FILE_COVERAGE_ON_PRS", + // For testing, this is not behind a CLI version check yet. However + // before rolling this out externally, we should set a minimum version here + // since current versions of the CodeQL CLI will log if baseline information + // cannot be found when interpreting results. + minimumVersion: void 0 + }, ["upload_overlay_db_to_api" /* UploadOverlayDbToApi */]: { defaultValue: false, envVar: "CODEQL_ACTION_UPLOAD_OVERLAY_DB_TO_API", diff --git a/lib/start-proxy-action-post.js b/lib/start-proxy-action-post.js index 6d42e77685..1f423b0dba 100644 --- a/lib/start-proxy-action-post.js +++ b/lib/start-proxy-action-post.js @@ -124132,6 +124132,15 @@ var featureConfig = { legacyApi: true, minimumVersion: void 0 }, + ["skip_file_coverage_on_prs" /* SkipFileCoverageOnPrs */]: { + defaultValue: false, + envVar: "CODEQL_ACTION_SKIP_FILE_COVERAGE_ON_PRS", + // For testing, this is not behind a CLI version check yet. However + // before rolling this out externally, we should set a minimum version here + // since current versions of the CodeQL CLI will log if baseline information + // cannot be found when interpreting results. + minimumVersion: void 0 + }, ["upload_overlay_db_to_api" /* UploadOverlayDbToApi */]: { defaultValue: false, envVar: "CODEQL_ACTION_UPLOAD_OVERLAY_DB_TO_API", diff --git a/lib/start-proxy-action.js b/lib/start-proxy-action.js index 39350b8091..a8cc0ce3c9 100644 --- a/lib/start-proxy-action.js +++ b/lib/start-proxy-action.js @@ -104438,6 +104438,15 @@ var featureConfig = { legacyApi: true, minimumVersion: void 0 }, + ["skip_file_coverage_on_prs" /* SkipFileCoverageOnPrs */]: { + defaultValue: false, + envVar: "CODEQL_ACTION_SKIP_FILE_COVERAGE_ON_PRS", + // For testing, this is not behind a CLI version check yet. However + // before rolling this out externally, we should set a minimum version here + // since current versions of the CodeQL CLI will log if baseline information + // cannot be found when interpreting results. + minimumVersion: void 0 + }, ["upload_overlay_db_to_api" /* UploadOverlayDbToApi */]: { defaultValue: false, envVar: "CODEQL_ACTION_UPLOAD_OVERLAY_DB_TO_API", diff --git a/lib/upload-lib.js b/lib/upload-lib.js index a59f2e93f4..fdf00e1ad2 100644 --- a/lib/upload-lib.js +++ b/lib/upload-lib.js @@ -90680,6 +90680,15 @@ var featureConfig = { legacyApi: true, minimumVersion: void 0 }, + ["skip_file_coverage_on_prs" /* SkipFileCoverageOnPrs */]: { + defaultValue: false, + envVar: "CODEQL_ACTION_SKIP_FILE_COVERAGE_ON_PRS", + // For testing, this is not behind a CLI version check yet. However + // before rolling this out externally, we should set a minimum version here + // since current versions of the CodeQL CLI will log if baseline information + // cannot be found when interpreting results. + minimumVersion: void 0 + }, ["upload_overlay_db_to_api" /* UploadOverlayDbToApi */]: { defaultValue: false, envVar: "CODEQL_ACTION_UPLOAD_OVERLAY_DB_TO_API", diff --git a/lib/upload-sarif-action-post.js b/lib/upload-sarif-action-post.js index c7e1156f3e..3bbc115bea 100644 --- a/lib/upload-sarif-action-post.js +++ b/lib/upload-sarif-action-post.js @@ -124294,6 +124294,15 @@ var featureConfig = { legacyApi: true, minimumVersion: void 0 }, + ["skip_file_coverage_on_prs" /* SkipFileCoverageOnPrs */]: { + defaultValue: false, + envVar: "CODEQL_ACTION_SKIP_FILE_COVERAGE_ON_PRS", + // For testing, this is not behind a CLI version check yet. However + // before rolling this out externally, we should set a minimum version here + // since current versions of the CodeQL CLI will log if baseline information + // cannot be found when interpreting results. + minimumVersion: void 0 + }, ["upload_overlay_db_to_api" /* UploadOverlayDbToApi */]: { defaultValue: false, envVar: "CODEQL_ACTION_UPLOAD_OVERLAY_DB_TO_API", diff --git a/lib/upload-sarif-action.js b/lib/upload-sarif-action.js index 1855fc99c4..44952cd8ec 100644 --- a/lib/upload-sarif-action.js +++ b/lib/upload-sarif-action.js @@ -90477,6 +90477,15 @@ var featureConfig = { legacyApi: true, minimumVersion: void 0 }, + ["skip_file_coverage_on_prs" /* SkipFileCoverageOnPrs */]: { + defaultValue: false, + envVar: "CODEQL_ACTION_SKIP_FILE_COVERAGE_ON_PRS", + // For testing, this is not behind a CLI version check yet. However + // before rolling this out externally, we should set a minimum version here + // since current versions of the CodeQL CLI will log if baseline information + // cannot be found when interpreting results. + minimumVersion: void 0 + }, ["upload_overlay_db_to_api" /* UploadOverlayDbToApi */]: { defaultValue: false, envVar: "CODEQL_ACTION_UPLOAD_OVERLAY_DB_TO_API", diff --git a/src/config-utils.test.ts b/src/config-utils.test.ts index 337eb85c59..276a7a344b 100644 --- a/src/config-utils.test.ts +++ b/src/config-utils.test.ts @@ -89,6 +89,7 @@ function createTestInitConfigInputs( }, features: createFeatures([]), repositoryProperties: {}, + enableFileCoverageInformation: true, logger: getRunnerLogger(true), } satisfies configUtils.InitConfigInputs, overrides, diff --git a/src/config-utils.ts b/src/config-utils.ts index 772c187b83..a010418993 100644 --- a/src/config-utils.ts +++ b/src/config-utils.ts @@ -214,6 +214,11 @@ export interface Config { * A partial mapping from repository properties that affect us to their values. */ repositoryProperties: RepositoryProperties; + + /** + * Whether to enable file coverage information. + */ + enableFileCoverageInformation: boolean; } async function getSupportedLanguageMap( @@ -433,6 +438,7 @@ export interface InitConfigInputs { apiDetails: api.GitHubApiCombinedDetails; features: FeatureEnablement; repositoryProperties: RepositoryProperties; + enableFileCoverageInformation: boolean; analysisKinds: AnalysisKind[]; logger: Logger; } @@ -462,6 +468,7 @@ export async function initActionState( repositoryProperties, analysisKinds, logger, + enableFileCoverageInformation, }: InitConfigInputs, userConfig: UserConfig, ): Promise { @@ -542,6 +549,7 @@ export async function initActionState( overlayDatabaseMode: OverlayDatabaseMode.None, useOverlayDatabaseCaching: false, repositoryProperties, + enableFileCoverageInformation, }; } diff --git a/src/feature-flags.ts b/src/feature-flags.ts index 7ad9ecfa48..cf88aabffc 100644 --- a/src/feature-flags.ts +++ b/src/feature-flags.ts @@ -70,6 +70,7 @@ export enum Feature { OverlayAnalysisSwift = "overlay_analysis_swift", PythonDefaultIsToNotExtractStdlib = "python_default_is_to_not_extract_stdlib", QaTelemetryEnabled = "qa_telemetry_enabled", + SkipFileCoverageOnPrs = "skip_file_coverage_on_prs", UploadOverlayDbToApi = "upload_overlay_db_to_api", UseRepositoryProperties = "use_repository_properties", ValidateDbConfig = "validate_db_config", @@ -286,6 +287,15 @@ export const featureConfig = { legacyApi: true, minimumVersion: undefined, }, + [Feature.SkipFileCoverageOnPrs]: { + defaultValue: false, + envVar: "CODEQL_ACTION_SKIP_FILE_COVERAGE_ON_PRS", + // For testing, this is not behind a CLI version check yet. However + // before rolling this out externally, we should set a minimum version here + // since current versions of the CodeQL CLI will log if baseline information + // cannot be found when interpreting results. + minimumVersion: undefined, + }, [Feature.UploadOverlayDbToApi]: { defaultValue: false, envVar: "CODEQL_ACTION_UPLOAD_OVERLAY_DB_TO_API", diff --git a/src/init-action.ts b/src/init-action.ts index 8b6c200a05..345dbff30d 100644 --- a/src/init-action.ts +++ b/src/init-action.ts @@ -13,6 +13,7 @@ import { getOptionalInput, getRequiredInput, getTemporaryDirectory, + isAnalyzingPullRequest, persistInputs, } from "./actions-util"; import { AnalysisKind, getAnalysisKinds } from "./analyses"; @@ -334,6 +335,7 @@ async function run(startedAt: Date) { } analysisKinds = await getAnalysisKinds(logger); + const debugMode = getOptionalInput("debug") === "true" || core.isDebug(); config = await initConfig(features, { analysisKinds, languagesInput: getOptionalInput("languages"), @@ -350,7 +352,7 @@ async function run(startedAt: Date) { // - The `init` Action is passed `debug: true`. // - Actions step debugging is enabled (e.g. by [enabling debug logging for a rerun](https://docs.github.com/en/actions/managing-workflow-runs/re-running-workflows-and-jobs#re-running-all-the-jobs-in-a-workflow), // or by setting the `ACTIONS_STEP_DEBUG` secret to `true`). - debugMode: getOptionalInput("debug") === "true" || core.isDebug(), + debugMode, debugArtifactName: getOptionalInput("debug-artifact-name") || DEFAULT_DEBUG_ARTIFACT_NAME, debugDatabaseName: @@ -364,6 +366,16 @@ async function run(startedAt: Date) { apiDetails, features, repositoryProperties, + enableFileCoverageInformation: + // Always enable file coverage information in debug mode + debugMode || + // We're most interested in speeding up PRs, and we want to keep + // submitting file coverage information for the default branch since + // it is used to populate the status page. + !isAnalyzingPullRequest() || + // For now, restrict this feature to the GitHub org + repositoryNwo.owner !== "github" || + !(await features.getValue(Feature.SkipFileCoverageOnPrs)), logger, }); diff --git a/src/testing-utils.ts b/src/testing-utils.ts index 66a6c25fb7..a2b8a5a941 100644 --- a/src/testing-utils.ts +++ b/src/testing-utils.ts @@ -408,6 +408,7 @@ export function createTestConfig(overrides: Partial): Config { overlayDatabaseMode: OverlayDatabaseMode.None, useOverlayDatabaseCaching: false, repositoryProperties: {}, + enableFileCoverageInformation: true, } satisfies Config, overrides, ); From e8c164b9021aac617aba0fdb3924a085ad1d9a3f Mon Sep 17 00:00:00 2001 From: Henry Mercer Date: Mon, 26 Jan 2026 10:33:30 +0000 Subject: [PATCH 02/11] Remove unused `database print-baseline` --- lib/analyze-action-post.js | 9 --------- lib/analyze-action.js | 9 --------- lib/autobuild-action.js | 9 --------- lib/init-action-post.js | 9 --------- lib/init-action.js | 9 --------- lib/resolve-environment-action.js | 9 --------- lib/setup-codeql-action.js | 9 --------- lib/upload-lib.js | 9 --------- lib/upload-sarif-action.js | 9 --------- src/analyze.test.ts | 1 - src/codeql.ts | 17 ----------------- 11 files changed, 99 deletions(-) diff --git a/lib/analyze-action-post.js b/lib/analyze-action-post.js index 2c32861a3d..b7888da1ec 100644 --- a/lib/analyze-action-post.js +++ b/lib/analyze-action-post.js @@ -125151,15 +125151,6 @@ ${output}` noStreamStdout: true }); }, - async databasePrintBaseline(databasePath) { - const codeqlArgs = [ - "database", - "print-baseline", - ...getExtraOptionsFromEnv(["database", "print-baseline"]), - databasePath - ]; - return await runCli(cmd, codeqlArgs); - }, async databaseCleanupCluster(config, cleanupLevel) { const cacheCleanupFlag = await codeQlVersionAtLeast( this, diff --git a/lib/analyze-action.js b/lib/analyze-action.js index ef704b6ced..ae915d822a 100644 --- a/lib/analyze-action.js +++ b/lib/analyze-action.js @@ -93251,15 +93251,6 @@ ${output}` noStreamStdout: true }); }, - async databasePrintBaseline(databasePath) { - const codeqlArgs = [ - "database", - "print-baseline", - ...getExtraOptionsFromEnv(["database", "print-baseline"]), - databasePath - ]; - return await runCli(cmd, codeqlArgs); - }, async databaseCleanupCluster(config, cleanupLevel) { const cacheCleanupFlag = await codeQlVersionAtLeast( this, diff --git a/lib/autobuild-action.js b/lib/autobuild-action.js index ef2885e7da..7b8c30a9f2 100644 --- a/lib/autobuild-action.js +++ b/lib/autobuild-action.js @@ -88351,15 +88351,6 @@ ${output}` noStreamStdout: true }); }, - async databasePrintBaseline(databasePath) { - const codeqlArgs = [ - "database", - "print-baseline", - ...getExtraOptionsFromEnv(["database", "print-baseline"]), - databasePath - ]; - return await runCli(cmd, codeqlArgs); - }, async databaseCleanupCluster(config, cleanupLevel) { const cacheCleanupFlag = await codeQlVersionAtLeast( this, diff --git a/lib/init-action-post.js b/lib/init-action-post.js index fc995b8e63..d255aa707b 100644 --- a/lib/init-action-post.js +++ b/lib/init-action-post.js @@ -129786,15 +129786,6 @@ ${output}` noStreamStdout: true }); }, - async databasePrintBaseline(databasePath) { - const codeqlArgs = [ - "database", - "print-baseline", - ...getExtraOptionsFromEnv(["database", "print-baseline"]), - databasePath - ]; - return await runCli(cmd, codeqlArgs); - }, async databaseCleanupCluster(config, cleanupLevel) { const cacheCleanupFlag = await codeQlVersionAtLeast( this, diff --git a/lib/init-action.js b/lib/init-action.js index b1100c0fdc..0832e5bdea 100644 --- a/lib/init-action.js +++ b/lib/init-action.js @@ -91601,15 +91601,6 @@ ${output}` noStreamStdout: true }); }, - async databasePrintBaseline(databasePath) { - const codeqlArgs = [ - "database", - "print-baseline", - ...getExtraOptionsFromEnv(["database", "print-baseline"]), - databasePath - ]; - return await runCli(cmd, codeqlArgs); - }, async databaseCleanupCluster(config, cleanupLevel) { const cacheCleanupFlag = await codeQlVersionAtLeast( this, diff --git a/lib/resolve-environment-action.js b/lib/resolve-environment-action.js index e3d81d1400..8630b474af 100644 --- a/lib/resolve-environment-action.js +++ b/lib/resolve-environment-action.js @@ -88044,15 +88044,6 @@ ${output}` noStreamStdout: true }); }, - async databasePrintBaseline(databasePath) { - const codeqlArgs = [ - "database", - "print-baseline", - ...getExtraOptionsFromEnv(["database", "print-baseline"]), - databasePath - ]; - return await runCli(cmd, codeqlArgs); - }, async databaseCleanupCluster(config, cleanupLevel) { const cacheCleanupFlag = await codeQlVersionAtLeast( this, diff --git a/lib/setup-codeql-action.js b/lib/setup-codeql-action.js index 79711e8204..308ef03c62 100644 --- a/lib/setup-codeql-action.js +++ b/lib/setup-codeql-action.js @@ -89353,15 +89353,6 @@ ${output}` noStreamStdout: true }); }, - async databasePrintBaseline(databasePath) { - const codeqlArgs = [ - "database", - "print-baseline", - ...getExtraOptionsFromEnv(["database", "print-baseline"]), - databasePath - ]; - return await runCli(cmd, codeqlArgs); - }, async databaseCleanupCluster(config, cleanupLevel) { const cacheCleanupFlag = await codeQlVersionAtLeast( this, diff --git a/lib/upload-lib.js b/lib/upload-lib.js index fdf00e1ad2..72617ffde7 100644 --- a/lib/upload-lib.js +++ b/lib/upload-lib.js @@ -92073,15 +92073,6 @@ ${output}` noStreamStdout: true }); }, - async databasePrintBaseline(databasePath) { - const codeqlArgs = [ - "database", - "print-baseline", - ...getExtraOptionsFromEnv(["database", "print-baseline"]), - databasePath - ]; - return await runCli(cmd, codeqlArgs); - }, async databaseCleanupCluster(config, cleanupLevel) { const cacheCleanupFlag = await codeQlVersionAtLeast( this, diff --git a/lib/upload-sarif-action.js b/lib/upload-sarif-action.js index 44952cd8ec..3541f24ede 100644 --- a/lib/upload-sarif-action.js +++ b/lib/upload-sarif-action.js @@ -92623,15 +92623,6 @@ ${output}` noStreamStdout: true }); }, - async databasePrintBaseline(databasePath) { - const codeqlArgs = [ - "database", - "print-baseline", - ...getExtraOptionsFromEnv(["database", "print-baseline"]), - databasePath - ]; - return await runCli(cmd, codeqlArgs); - }, async databaseCleanupCluster(config, cleanupLevel) { const cacheCleanupFlag = await codeQlVersionAtLeast( this, diff --git a/src/analyze.test.ts b/src/analyze.test.ts index ceabf62baa..27fe4a6f47 100644 --- a/src/analyze.test.ts +++ b/src/analyze.test.ts @@ -87,7 +87,6 @@ test("status report fields", async (t) => { ); return ""; }, - databasePrintBaseline: async () => "", }); const config = createTestConfig({ diff --git a/src/codeql.ts b/src/codeql.ts index f70e5ffa4f..97f2f60283 100644 --- a/src/codeql.ts +++ b/src/codeql.ts @@ -186,10 +186,6 @@ export interface CodeQL { config: Config, features: FeatureEnablement, ): Promise; - /** - * Run 'codeql database print-baseline'. - */ - databasePrintBaseline(databasePath: string): Promise; /** * Run 'codeql database export-diagnostics' * @@ -493,10 +489,6 @@ export function createStubCodeQL(partialCodeql: Partial): CodeQL { partialCodeql, "databaseInterpretResults", ), - databasePrintBaseline: resolveFunction( - partialCodeql, - "databasePrintBaseline", - ), databaseExportDiagnostics: resolveFunction( partialCodeql, "databaseExportDiagnostics", @@ -885,15 +877,6 @@ async function getCodeQLForCmd( noStreamStdout: true, }); }, - async databasePrintBaseline(databasePath: string): Promise { - const codeqlArgs = [ - "database", - "print-baseline", - ...getExtraOptionsFromEnv(["database", "print-baseline"]), - databasePath, - ]; - return await runCli(cmd, codeqlArgs); - }, async databaseCleanupCluster( config: Config, cleanupLevel: CleanupLevel, From 4918026b93b8ced8934d028b83dc9858b66cd52e Mon Sep 17 00:00:00 2001 From: Henry Mercer Date: Mon, 26 Jan 2026 10:54:34 +0000 Subject: [PATCH 03/11] Use FF to disable baseline file coverage --- lib/analyze-action-post.js | 9 ++++++--- lib/analyze-action.js | 9 ++++++--- lib/autobuild-action.js | 9 ++++++--- lib/init-action-post.js | 9 ++++++--- lib/init-action.js | 9 ++++++--- lib/resolve-environment-action.js | 9 ++++++--- lib/setup-codeql-action.js | 9 ++++++--- lib/upload-lib.js | 9 ++++++--- lib/upload-sarif-action.js | 9 ++++++--- src/codeql.ts | 12 +++++++++--- 10 files changed, 63 insertions(+), 30 deletions(-) diff --git a/lib/analyze-action-post.js b/lib/analyze-action-post.js index b7888da1ec..bccb69dddc 100644 --- a/lib/analyze-action-post.js +++ b/lib/analyze-action-post.js @@ -124950,6 +124950,10 @@ async function getCodeQLForCmd(cmd, checkVersion) { } else if (overlayDatabaseMode === "overlay-base" /* OverlayBase */) { extraArgs.push("--overlay-base"); } + const baselineFilesOptions = config.enableFileCoverageInformation ? [ + "--calculate-language-specific-baseline", + "--sublanguage-file-coverage" + ] : ["--no-calculate-baseline"]; await runCli( cmd, [ @@ -124959,12 +124963,11 @@ async function getCodeQLForCmd(cmd, checkVersion) { "--db-cluster", config.dbLocation, `--source-root=${sourceRoot}`, - "--calculate-language-specific-baseline", + ...baselineFilesOptions, "--extractor-include-aliases", - "--sublanguage-file-coverage", ...extraArgs, ...getExtraOptionsFromEnv(["database", "init"], { - ignoringOptions: ["--overwrite"] + ignoringOptions: ["--overwrite", ...baselineFilesOptions] }) ], { stdin: externalRepositoryToken } diff --git a/lib/analyze-action.js b/lib/analyze-action.js index ae915d822a..fa7fdcb0d0 100644 --- a/lib/analyze-action.js +++ b/lib/analyze-action.js @@ -93050,6 +93050,10 @@ async function getCodeQLForCmd(cmd, checkVersion) { } else if (overlayDatabaseMode === "overlay-base" /* OverlayBase */) { extraArgs.push("--overlay-base"); } + const baselineFilesOptions = config.enableFileCoverageInformation ? [ + "--calculate-language-specific-baseline", + "--sublanguage-file-coverage" + ] : ["--no-calculate-baseline"]; await runCli( cmd, [ @@ -93059,12 +93063,11 @@ async function getCodeQLForCmd(cmd, checkVersion) { "--db-cluster", config.dbLocation, `--source-root=${sourceRoot}`, - "--calculate-language-specific-baseline", + ...baselineFilesOptions, "--extractor-include-aliases", - "--sublanguage-file-coverage", ...extraArgs, ...getExtraOptionsFromEnv(["database", "init"], { - ignoringOptions: ["--overwrite"] + ignoringOptions: ["--overwrite", ...baselineFilesOptions] }) ], { stdin: externalRepositoryToken } diff --git a/lib/autobuild-action.js b/lib/autobuild-action.js index 7b8c30a9f2..1b46f3e60e 100644 --- a/lib/autobuild-action.js +++ b/lib/autobuild-action.js @@ -88150,6 +88150,10 @@ async function getCodeQLForCmd(cmd, checkVersion) { } else if (overlayDatabaseMode === "overlay-base" /* OverlayBase */) { extraArgs.push("--overlay-base"); } + const baselineFilesOptions = config.enableFileCoverageInformation ? [ + "--calculate-language-specific-baseline", + "--sublanguage-file-coverage" + ] : ["--no-calculate-baseline"]; await runCli( cmd, [ @@ -88159,12 +88163,11 @@ async function getCodeQLForCmd(cmd, checkVersion) { "--db-cluster", config.dbLocation, `--source-root=${sourceRoot}`, - "--calculate-language-specific-baseline", + ...baselineFilesOptions, "--extractor-include-aliases", - "--sublanguage-file-coverage", ...extraArgs, ...getExtraOptionsFromEnv(["database", "init"], { - ignoringOptions: ["--overwrite"] + ignoringOptions: ["--overwrite", ...baselineFilesOptions] }) ], { stdin: externalRepositoryToken } diff --git a/lib/init-action-post.js b/lib/init-action-post.js index d255aa707b..39937f99e4 100644 --- a/lib/init-action-post.js +++ b/lib/init-action-post.js @@ -129585,6 +129585,10 @@ async function getCodeQLForCmd(cmd, checkVersion) { } else if (overlayDatabaseMode === "overlay-base" /* OverlayBase */) { extraArgs.push("--overlay-base"); } + const baselineFilesOptions = config.enableFileCoverageInformation ? [ + "--calculate-language-specific-baseline", + "--sublanguage-file-coverage" + ] : ["--no-calculate-baseline"]; await runCli( cmd, [ @@ -129594,12 +129598,11 @@ async function getCodeQLForCmd(cmd, checkVersion) { "--db-cluster", config.dbLocation, `--source-root=${sourceRoot}`, - "--calculate-language-specific-baseline", + ...baselineFilesOptions, "--extractor-include-aliases", - "--sublanguage-file-coverage", ...extraArgs, ...getExtraOptionsFromEnv(["database", "init"], { - ignoringOptions: ["--overwrite"] + ignoringOptions: ["--overwrite", ...baselineFilesOptions] }) ], { stdin: externalRepositoryToken } diff --git a/lib/init-action.js b/lib/init-action.js index 0832e5bdea..f11ff59306 100644 --- a/lib/init-action.js +++ b/lib/init-action.js @@ -91400,6 +91400,10 @@ async function getCodeQLForCmd(cmd, checkVersion) { } else if (overlayDatabaseMode === "overlay-base" /* OverlayBase */) { extraArgs.push("--overlay-base"); } + const baselineFilesOptions = config.enableFileCoverageInformation ? [ + "--calculate-language-specific-baseline", + "--sublanguage-file-coverage" + ] : ["--no-calculate-baseline"]; await runCli( cmd, [ @@ -91409,12 +91413,11 @@ async function getCodeQLForCmd(cmd, checkVersion) { "--db-cluster", config.dbLocation, `--source-root=${sourceRoot}`, - "--calculate-language-specific-baseline", + ...baselineFilesOptions, "--extractor-include-aliases", - "--sublanguage-file-coverage", ...extraArgs, ...getExtraOptionsFromEnv(["database", "init"], { - ignoringOptions: ["--overwrite"] + ignoringOptions: ["--overwrite", ...baselineFilesOptions] }) ], { stdin: externalRepositoryToken } diff --git a/lib/resolve-environment-action.js b/lib/resolve-environment-action.js index 8630b474af..a62917f014 100644 --- a/lib/resolve-environment-action.js +++ b/lib/resolve-environment-action.js @@ -87843,6 +87843,10 @@ async function getCodeQLForCmd(cmd, checkVersion) { } else if (overlayDatabaseMode === "overlay-base" /* OverlayBase */) { extraArgs.push("--overlay-base"); } + const baselineFilesOptions = config.enableFileCoverageInformation ? [ + "--calculate-language-specific-baseline", + "--sublanguage-file-coverage" + ] : ["--no-calculate-baseline"]; await runCli( cmd, [ @@ -87852,12 +87856,11 @@ async function getCodeQLForCmd(cmd, checkVersion) { "--db-cluster", config.dbLocation, `--source-root=${sourceRoot}`, - "--calculate-language-specific-baseline", + ...baselineFilesOptions, "--extractor-include-aliases", - "--sublanguage-file-coverage", ...extraArgs, ...getExtraOptionsFromEnv(["database", "init"], { - ignoringOptions: ["--overwrite"] + ignoringOptions: ["--overwrite", ...baselineFilesOptions] }) ], { stdin: externalRepositoryToken } diff --git a/lib/setup-codeql-action.js b/lib/setup-codeql-action.js index 308ef03c62..0a480cea15 100644 --- a/lib/setup-codeql-action.js +++ b/lib/setup-codeql-action.js @@ -89152,6 +89152,10 @@ async function getCodeQLForCmd(cmd, checkVersion) { } else if (overlayDatabaseMode === "overlay-base" /* OverlayBase */) { extraArgs.push("--overlay-base"); } + const baselineFilesOptions = config.enableFileCoverageInformation ? [ + "--calculate-language-specific-baseline", + "--sublanguage-file-coverage" + ] : ["--no-calculate-baseline"]; await runCli( cmd, [ @@ -89161,12 +89165,11 @@ async function getCodeQLForCmd(cmd, checkVersion) { "--db-cluster", config.dbLocation, `--source-root=${sourceRoot}`, - "--calculate-language-specific-baseline", + ...baselineFilesOptions, "--extractor-include-aliases", - "--sublanguage-file-coverage", ...extraArgs, ...getExtraOptionsFromEnv(["database", "init"], { - ignoringOptions: ["--overwrite"] + ignoringOptions: ["--overwrite", ...baselineFilesOptions] }) ], { stdin: externalRepositoryToken } diff --git a/lib/upload-lib.js b/lib/upload-lib.js index 72617ffde7..9efe1fac54 100644 --- a/lib/upload-lib.js +++ b/lib/upload-lib.js @@ -91872,6 +91872,10 @@ async function getCodeQLForCmd(cmd, checkVersion) { } else if (overlayDatabaseMode === "overlay-base" /* OverlayBase */) { extraArgs.push("--overlay-base"); } + const baselineFilesOptions = config.enableFileCoverageInformation ? [ + "--calculate-language-specific-baseline", + "--sublanguage-file-coverage" + ] : ["--no-calculate-baseline"]; await runCli( cmd, [ @@ -91881,12 +91885,11 @@ async function getCodeQLForCmd(cmd, checkVersion) { "--db-cluster", config.dbLocation, `--source-root=${sourceRoot}`, - "--calculate-language-specific-baseline", + ...baselineFilesOptions, "--extractor-include-aliases", - "--sublanguage-file-coverage", ...extraArgs, ...getExtraOptionsFromEnv(["database", "init"], { - ignoringOptions: ["--overwrite"] + ignoringOptions: ["--overwrite", ...baselineFilesOptions] }) ], { stdin: externalRepositoryToken } diff --git a/lib/upload-sarif-action.js b/lib/upload-sarif-action.js index 3541f24ede..469329222f 100644 --- a/lib/upload-sarif-action.js +++ b/lib/upload-sarif-action.js @@ -92422,6 +92422,10 @@ async function getCodeQLForCmd(cmd, checkVersion) { } else if (overlayDatabaseMode === "overlay-base" /* OverlayBase */) { extraArgs.push("--overlay-base"); } + const baselineFilesOptions = config.enableFileCoverageInformation ? [ + "--calculate-language-specific-baseline", + "--sublanguage-file-coverage" + ] : ["--no-calculate-baseline"]; await runCli( cmd, [ @@ -92431,12 +92435,11 @@ async function getCodeQLForCmd(cmd, checkVersion) { "--db-cluster", config.dbLocation, `--source-root=${sourceRoot}`, - "--calculate-language-specific-baseline", + ...baselineFilesOptions, "--extractor-include-aliases", - "--sublanguage-file-coverage", ...extraArgs, ...getExtraOptionsFromEnv(["database", "init"], { - ignoringOptions: ["--overwrite"] + ignoringOptions: ["--overwrite", ...baselineFilesOptions] }) ], { stdin: externalRepositoryToken } diff --git a/src/codeql.ts b/src/codeql.ts index 97f2f60283..c5c84f4d74 100644 --- a/src/codeql.ts +++ b/src/codeql.ts @@ -620,6 +620,13 @@ async function getCodeQLForCmd( extraArgs.push("--overlay-base"); } + const baselineFilesOptions = config.enableFileCoverageInformation + ? [ + "--calculate-language-specific-baseline", + "--sublanguage-file-coverage", + ] + : ["--no-calculate-baseline"]; + await runCli( cmd, [ @@ -631,12 +638,11 @@ async function getCodeQLForCmd( "--db-cluster", config.dbLocation, `--source-root=${sourceRoot}`, - "--calculate-language-specific-baseline", + ...baselineFilesOptions, "--extractor-include-aliases", - "--sublanguage-file-coverage", ...extraArgs, ...getExtraOptionsFromEnv(["database", "init"], { - ignoringOptions: ["--overwrite"], + ignoringOptions: ["--overwrite", ...baselineFilesOptions], }), ], { stdin: externalRepositoryToken }, From 919e8aaa401fabb42a69baa7d348e3bb6d04629c Mon Sep 17 00:00:00 2001 From: Henry Mercer Date: Mon, 26 Jan 2026 10:55:31 +0000 Subject: [PATCH 04/11] Mention caveat in feature JSDoc --- src/feature-flags.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/feature-flags.ts b/src/feature-flags.ts index cf88aabffc..8de68a28d7 100644 --- a/src/feature-flags.ts +++ b/src/feature-flags.ts @@ -70,6 +70,7 @@ export enum Feature { OverlayAnalysisSwift = "overlay_analysis_swift", PythonDefaultIsToNotExtractStdlib = "python_default_is_to_not_extract_stdlib", QaTelemetryEnabled = "qa_telemetry_enabled", + /** Note that this currently only disables baseline file coverage information. */ SkipFileCoverageOnPrs = "skip_file_coverage_on_prs", UploadOverlayDbToApi = "upload_overlay_db_to_api", UseRepositoryProperties = "use_repository_properties", From 12c4c7d0e9cee3768780e416b8bbb5de69cc4034 Mon Sep 17 00:00:00 2001 From: Henry Mercer Date: Mon, 26 Jan 2026 11:21:22 +0000 Subject: [PATCH 05/11] Don't log empty summaries --- lib/analyze-action.js | 6 ++++-- src/analyze.ts | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/analyze-action.js b/lib/analyze-action.js index fa7fdcb0d0..a6dfba7567 100644 --- a/lib/analyze-action.js +++ b/lib/analyze-action.js @@ -94009,8 +94009,10 @@ async function runQueries(sarifFolder, memoryFlag, threadsFlag, diffRangePackDir const endTimeInterpretResults = /* @__PURE__ */ new Date(); statusReport[`interpret_results_${language}_duration_ms`] = endTimeInterpretResults.getTime() - startTimeInterpretResults.getTime(); logger.endGroup(); - logger.info(analysisSummary); - if (qualityAnalysisSummary) { + if (analysisSummary.trim()) { + logger.info(analysisSummary); + } + if (qualityAnalysisSummary?.trim()) { logger.info(qualityAnalysisSummary); } if (await features.getValue("qa_telemetry_enabled" /* QaTelemetryEnabled */)) { diff --git a/src/analyze.ts b/src/analyze.ts index dc631ba98f..7094468a5c 100644 --- a/src/analyze.ts +++ b/src/analyze.ts @@ -495,8 +495,10 @@ export async function runQueries( endTimeInterpretResults.getTime() - startTimeInterpretResults.getTime(); logger.endGroup(); - logger.info(analysisSummary); - if (qualityAnalysisSummary) { + if (analysisSummary.trim()) { + logger.info(analysisSummary); + } + if (qualityAnalysisSummary?.trim()) { logger.info(qualityAnalysisSummary); } From 1996ca9f5de755225d03010f3ef0dba3173683fe Mon Sep 17 00:00:00 2001 From: Henry Mercer Date: Mon, 26 Jan 2026 11:21:41 +0000 Subject: [PATCH 06/11] Log when file coverage info is disabled --- lib/analyze-action.js | 5 +++++ src/analyze.ts | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/lib/analyze-action.js b/lib/analyze-action.js index a6dfba7567..7af9d2f1d0 100644 --- a/lib/analyze-action.js +++ b/lib/analyze-action.js @@ -94015,6 +94015,11 @@ async function runQueries(sarifFolder, memoryFlag, threadsFlag, diffRangePackDir if (qualityAnalysisSummary?.trim()) { logger.info(qualityAnalysisSummary); } + if (!config.enableFileCoverageInformation) { + logger.info( + "File coverage information is disabled for this PR analysis for performance reasons. It will still be enabled for analyses triggered by a push or a schedule." + ); + } if (await features.getValue("qa_telemetry_enabled" /* QaTelemetryEnabled */)) { const perQueryAlertCounts = getPerQueryAlertCounts(sarifFile); const perQueryAlertCountEventReport = { diff --git a/src/analyze.ts b/src/analyze.ts index 7094468a5c..0bbd3973c4 100644 --- a/src/analyze.ts +++ b/src/analyze.ts @@ -501,6 +501,12 @@ export async function runQueries( if (qualityAnalysisSummary?.trim()) { logger.info(qualityAnalysisSummary); } + if (!config.enableFileCoverageInformation) { + logger.info( + "File coverage information is disabled for this PR analysis for performance reasons. " + + "It will still be enabled for analyses triggered by a push or a schedule.", + ); + } if (await features.getValue(Feature.QaTelemetryEnabled)) { // Note: QA adds the `code-quality` query suite to the `queries` input, From 18c2cfc76579432289b7d702e29ee69f1b2fcf53 Mon Sep 17 00:00:00 2001 From: Henry Mercer Date: Mon, 26 Jan 2026 11:24:35 +0000 Subject: [PATCH 07/11] Indulge `caniuse-lite` to avoid build warnings --- package-lock.json | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index a4792f7fdf..a5a08c4361 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3834,9 +3834,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001727", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001727.tgz", - "integrity": "sha512-pB68nIHmbN6L/4C6MH1DokyR3bYqFwjaSs/sWDHGj4CTcFtQUQMuJftVwWkXq7mNWOybD3KhUv3oWHoGxgP14Q==", + "version": "1.0.30001766", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001766.tgz", + "integrity": "sha512-4C0lfJ0/YPjJQHagaE9x2Elb69CIqEPZeG0anQt9SIvIoOH4a4uaRl73IavyO+0qZh6MDLH//DrXThEYKHkmYA==", "dev": true, "funding": [ { @@ -3851,7 +3851,8 @@ "type": "github", "url": "https://github.com/sponsors/ai" } - ] + ], + "license": "CC-BY-4.0" }, "node_modules/cbor": { "version": "10.0.9", From 17cd47509988204615feabcca9b6dc0b4ae03d44 Mon Sep 17 00:00:00 2001 From: Henry Mercer Date: Mon, 26 Jan 2026 17:55:17 +0000 Subject: [PATCH 08/11] Move to separate function --- lib/init-action.js | 21 ++++++++++++++------- src/init-action.ts | 37 +++++++++++++++++++++++++------------ 2 files changed, 39 insertions(+), 19 deletions(-) diff --git a/lib/init-action.js b/lib/init-action.js index f11ff59306..bf16508ecb 100644 --- a/lib/init-action.js +++ b/lib/init-action.js @@ -92660,13 +92660,10 @@ async function run(startedAt) { apiDetails, features, repositoryProperties, - enableFileCoverageInformation: ( - // Always enable file coverage information in debug mode - debugMode || // We're most interested in speeding up PRs, and we want to keep - // submitting file coverage information for the default branch since - // it is used to populate the status page. - !isAnalyzingPullRequest() || // For now, restrict this feature to the GitHub org - repositoryNwo.owner !== "github" || !await features.getValue("skip_file_coverage_on_prs" /* SkipFileCoverageOnPrs */) + enableFileCoverageInformation: await getFileCoverageInformationEnabled( + debugMode, + repositoryNwo, + features ), logger }); @@ -92960,6 +92957,16 @@ function getTrapCachingEnabled() { if (!isHostedRunner()) return false; return true; } +async function getFileCoverageInformationEnabled(debugMode, repositoryNwo, features) { + return ( + // Always enable file coverage information in debug mode + debugMode || // We're most interested in speeding up PRs, and we want to keep + // submitting file coverage information for the default branch since + // it is used to populate the status page. + !isAnalyzingPullRequest() || // For now, restrict this feature to the GitHub org + repositoryNwo.owner !== "github" || !await features.getValue("skip_file_coverage_on_prs" /* SkipFileCoverageOnPrs */) + ); +} async function recordZstdAvailability(config, zstdAvailability) { addDiagnostic( config, diff --git a/src/init-action.ts b/src/init-action.ts index 345dbff30d..4853467389 100644 --- a/src/init-action.ts +++ b/src/init-action.ts @@ -37,7 +37,7 @@ import { makeTelemetryDiagnostic, } from "./diagnostics"; import { EnvVar } from "./environment"; -import { Feature, Features } from "./feature-flags"; +import { Feature, FeatureEnablement, Features } from "./feature-flags"; import { loadPropertiesFromApi } from "./feature-flags/properties"; import { checkInstallPython311, @@ -54,7 +54,7 @@ import { OverlayBaseDatabaseDownloadStats, OverlayDatabaseMode, } from "./overlay-database-utils"; -import { getRepositoryNwo } from "./repository"; +import { getRepositoryNwo, RepositoryNwo } from "./repository"; import { ToolsSource } from "./setup-codeql"; import { ActionName, @@ -366,16 +366,11 @@ async function run(startedAt: Date) { apiDetails, features, repositoryProperties, - enableFileCoverageInformation: - // Always enable file coverage information in debug mode - debugMode || - // We're most interested in speeding up PRs, and we want to keep - // submitting file coverage information for the default branch since - // it is used to populate the status page. - !isAnalyzingPullRequest() || - // For now, restrict this feature to the GitHub org - repositoryNwo.owner !== "github" || - !(await features.getValue(Feature.SkipFileCoverageOnPrs)), + enableFileCoverageInformation: await getFileCoverageInformationEnabled( + debugMode, + repositoryNwo, + features, + ), logger, }); @@ -799,6 +794,24 @@ function getTrapCachingEnabled(): boolean { return true; } +async function getFileCoverageInformationEnabled( + debugMode: boolean, + repositoryNwo: RepositoryNwo, + features: FeatureEnablement, +): Promise { + return ( + // Always enable file coverage information in debug mode + debugMode || + // We're most interested in speeding up PRs, and we want to keep + // submitting file coverage information for the default branch since + // it is used to populate the status page. + !isAnalyzingPullRequest() || + // For now, restrict this feature to the GitHub org + repositoryNwo.owner !== "github" || + !(await features.getValue(Feature.SkipFileCoverageOnPrs)) + ); +} + async function recordZstdAvailability( config: configUtils.Config, zstdAvailability: ZstdAvailability, From 9a55d5bc5f895fecc3e45438f3ec7731948454f7 Mon Sep 17 00:00:00 2001 From: Henry Mercer Date: Mon, 26 Jan 2026 18:00:34 +0000 Subject: [PATCH 09/11] Improve log message --- lib/analyze-action.js | 2 +- src/analyze.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/analyze-action.js b/lib/analyze-action.js index 7af9d2f1d0..735ba11273 100644 --- a/lib/analyze-action.js +++ b/lib/analyze-action.js @@ -94017,7 +94017,7 @@ async function runQueries(sarifFolder, memoryFlag, threadsFlag, diffRangePackDir } if (!config.enableFileCoverageInformation) { logger.info( - "File coverage information is disabled for this PR analysis for performance reasons. It will still be enabled for analyses triggered by a push or a schedule." + "To speed up pull request analysis, file coverage information is only enabled when analyzing the default branch and protected branches." ); } if (await features.getValue("qa_telemetry_enabled" /* QaTelemetryEnabled */)) { diff --git a/src/analyze.ts b/src/analyze.ts index 0bbd3973c4..bb38415047 100644 --- a/src/analyze.ts +++ b/src/analyze.ts @@ -503,8 +503,8 @@ export async function runQueries( } if (!config.enableFileCoverageInformation) { logger.info( - "File coverage information is disabled for this PR analysis for performance reasons. " + - "It will still be enabled for analyses triggered by a push or a schedule.", + "To speed up pull request analysis, file coverage information is only enabled when analyzing " + + "the default branch and protected branches.", ); } From f1aa4f497a55bf3d2212738286a05d145607a822 Mon Sep 17 00:00:00 2001 From: Henry Mercer Date: Mon, 26 Jan 2026 18:02:58 +0000 Subject: [PATCH 10/11] Explain why we ignore extra baseline files options --- lib/analyze-action-post.js | 3 +++ lib/analyze-action.js | 3 +++ lib/autobuild-action.js | 3 +++ lib/init-action-post.js | 3 +++ lib/init-action.js | 3 +++ lib/resolve-environment-action.js | 3 +++ lib/setup-codeql-action.js | 3 +++ lib/upload-lib.js | 3 +++ lib/upload-sarif-action.js | 3 +++ src/codeql.ts | 3 +++ 10 files changed, 30 insertions(+) diff --git a/lib/analyze-action-post.js b/lib/analyze-action-post.js index bccb69dddc..a7d4804875 100644 --- a/lib/analyze-action-post.js +++ b/lib/analyze-action-post.js @@ -124967,6 +124967,9 @@ async function getCodeQLForCmd(cmd, checkVersion) { "--extractor-include-aliases", ...extraArgs, ...getExtraOptionsFromEnv(["database", "init"], { + // Some user configs specify `--no-calculate-baseline` as an additional + // argument to `codeql database init`. Therefore ignore the baseline file + // options here to avoid specifying the same argument twice and erroring. ignoringOptions: ["--overwrite", ...baselineFilesOptions] }) ], diff --git a/lib/analyze-action.js b/lib/analyze-action.js index 735ba11273..c80deb0775 100644 --- a/lib/analyze-action.js +++ b/lib/analyze-action.js @@ -93067,6 +93067,9 @@ async function getCodeQLForCmd(cmd, checkVersion) { "--extractor-include-aliases", ...extraArgs, ...getExtraOptionsFromEnv(["database", "init"], { + // Some user configs specify `--no-calculate-baseline` as an additional + // argument to `codeql database init`. Therefore ignore the baseline file + // options here to avoid specifying the same argument twice and erroring. ignoringOptions: ["--overwrite", ...baselineFilesOptions] }) ], diff --git a/lib/autobuild-action.js b/lib/autobuild-action.js index 1b46f3e60e..e86b41e428 100644 --- a/lib/autobuild-action.js +++ b/lib/autobuild-action.js @@ -88167,6 +88167,9 @@ async function getCodeQLForCmd(cmd, checkVersion) { "--extractor-include-aliases", ...extraArgs, ...getExtraOptionsFromEnv(["database", "init"], { + // Some user configs specify `--no-calculate-baseline` as an additional + // argument to `codeql database init`. Therefore ignore the baseline file + // options here to avoid specifying the same argument twice and erroring. ignoringOptions: ["--overwrite", ...baselineFilesOptions] }) ], diff --git a/lib/init-action-post.js b/lib/init-action-post.js index 39937f99e4..5c1de14d3f 100644 --- a/lib/init-action-post.js +++ b/lib/init-action-post.js @@ -129602,6 +129602,9 @@ async function getCodeQLForCmd(cmd, checkVersion) { "--extractor-include-aliases", ...extraArgs, ...getExtraOptionsFromEnv(["database", "init"], { + // Some user configs specify `--no-calculate-baseline` as an additional + // argument to `codeql database init`. Therefore ignore the baseline file + // options here to avoid specifying the same argument twice and erroring. ignoringOptions: ["--overwrite", ...baselineFilesOptions] }) ], diff --git a/lib/init-action.js b/lib/init-action.js index bf16508ecb..c970552e4a 100644 --- a/lib/init-action.js +++ b/lib/init-action.js @@ -91417,6 +91417,9 @@ async function getCodeQLForCmd(cmd, checkVersion) { "--extractor-include-aliases", ...extraArgs, ...getExtraOptionsFromEnv(["database", "init"], { + // Some user configs specify `--no-calculate-baseline` as an additional + // argument to `codeql database init`. Therefore ignore the baseline file + // options here to avoid specifying the same argument twice and erroring. ignoringOptions: ["--overwrite", ...baselineFilesOptions] }) ], diff --git a/lib/resolve-environment-action.js b/lib/resolve-environment-action.js index a62917f014..0d30268fed 100644 --- a/lib/resolve-environment-action.js +++ b/lib/resolve-environment-action.js @@ -87860,6 +87860,9 @@ async function getCodeQLForCmd(cmd, checkVersion) { "--extractor-include-aliases", ...extraArgs, ...getExtraOptionsFromEnv(["database", "init"], { + // Some user configs specify `--no-calculate-baseline` as an additional + // argument to `codeql database init`. Therefore ignore the baseline file + // options here to avoid specifying the same argument twice and erroring. ignoringOptions: ["--overwrite", ...baselineFilesOptions] }) ], diff --git a/lib/setup-codeql-action.js b/lib/setup-codeql-action.js index 0a480cea15..69da4817b3 100644 --- a/lib/setup-codeql-action.js +++ b/lib/setup-codeql-action.js @@ -89169,6 +89169,9 @@ async function getCodeQLForCmd(cmd, checkVersion) { "--extractor-include-aliases", ...extraArgs, ...getExtraOptionsFromEnv(["database", "init"], { + // Some user configs specify `--no-calculate-baseline` as an additional + // argument to `codeql database init`. Therefore ignore the baseline file + // options here to avoid specifying the same argument twice and erroring. ignoringOptions: ["--overwrite", ...baselineFilesOptions] }) ], diff --git a/lib/upload-lib.js b/lib/upload-lib.js index 9efe1fac54..a41c4d41db 100644 --- a/lib/upload-lib.js +++ b/lib/upload-lib.js @@ -91889,6 +91889,9 @@ async function getCodeQLForCmd(cmd, checkVersion) { "--extractor-include-aliases", ...extraArgs, ...getExtraOptionsFromEnv(["database", "init"], { + // Some user configs specify `--no-calculate-baseline` as an additional + // argument to `codeql database init`. Therefore ignore the baseline file + // options here to avoid specifying the same argument twice and erroring. ignoringOptions: ["--overwrite", ...baselineFilesOptions] }) ], diff --git a/lib/upload-sarif-action.js b/lib/upload-sarif-action.js index 469329222f..ba69d872d4 100644 --- a/lib/upload-sarif-action.js +++ b/lib/upload-sarif-action.js @@ -92439,6 +92439,9 @@ async function getCodeQLForCmd(cmd, checkVersion) { "--extractor-include-aliases", ...extraArgs, ...getExtraOptionsFromEnv(["database", "init"], { + // Some user configs specify `--no-calculate-baseline` as an additional + // argument to `codeql database init`. Therefore ignore the baseline file + // options here to avoid specifying the same argument twice and erroring. ignoringOptions: ["--overwrite", ...baselineFilesOptions] }) ], diff --git a/src/codeql.ts b/src/codeql.ts index c5c84f4d74..8e7c2bfe26 100644 --- a/src/codeql.ts +++ b/src/codeql.ts @@ -642,6 +642,9 @@ async function getCodeQLForCmd( "--extractor-include-aliases", ...extraArgs, ...getExtraOptionsFromEnv(["database", "init"], { + // Some user configs specify `--no-calculate-baseline` as an additional + // argument to `codeql database init`. Therefore ignore the baseline file + // options here to avoid specifying the same argument twice and erroring. ignoringOptions: ["--overwrite", ...baselineFilesOptions], }), ], From bf20b3e07b36147df035fdd0330c20f193a91bd6 Mon Sep 17 00:00:00 2001 From: Henry Mercer Date: Mon, 26 Jan 2026 18:04:37 +0000 Subject: [PATCH 11/11] Exclude PR check from feature flag --- .github/workflows/__export-file-baseline-information.yml | 1 + pr-checks/checks/export-file-baseline-information.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/__export-file-baseline-information.yml b/.github/workflows/__export-file-baseline-information.yml index f157c23f75..41fb9220fd 100644 --- a/.github/workflows/__export-file-baseline-information.yml +++ b/.github/workflows/__export-file-baseline-information.yml @@ -125,5 +125,6 @@ jobs: fi done env: + CODEQL_ACTION_SKIP_FILE_COVERAGE_ON_PRS: false CODEQL_ACTION_SUBLANGUAGE_FILE_COVERAGE: true CODEQL_ACTION_TEST_MODE: true diff --git a/pr-checks/checks/export-file-baseline-information.yml b/pr-checks/checks/export-file-baseline-information.yml index fdc352285c..e45fc58ca3 100644 --- a/pr-checks/checks/export-file-baseline-information.yml +++ b/pr-checks/checks/export-file-baseline-information.yml @@ -5,6 +5,7 @@ versions: ["nightly-latest"] installGo: true installDotNet: true env: + CODEQL_ACTION_SKIP_FILE_COVERAGE_ON_PRS: false CODEQL_ACTION_SUBLANGUAGE_FILE_COVERAGE: true steps: - uses: ./../action/init