From 06898d7b8bf8f14f2ddfe70880553771f27d27e5 Mon Sep 17 00:00:00 2001 From: "Michael B. Gale" Date: Wed, 8 Jul 2026 17:46:02 +0100 Subject: [PATCH] Rename `mergeUserConfigs` --- lib/entry-points.js | 4 ++-- src/config-utils.ts | 7 ++++--- src/config/db-config.test.ts | 24 ++++++++++++++++-------- src/config/db-config.ts | 2 +- 4 files changed, 23 insertions(+), 14 deletions(-) diff --git a/lib/entry-points.js b/lib/entry-points.js index 279019891..2ee1726a9 100644 --- a/lib/entry-points.js +++ b/lib/entry-points.js @@ -147701,7 +147701,7 @@ function isKnownPropertyName(name) { } // src/config/db-config.ts -function mergeUserConfigs(logger, fromConfigInput, fromConfigFile) { +function mergeDefaultSetupAndUserConfigs(logger, fromConfigInput, fromConfigFile) { logger.debug( "Combining configuration files from 'config' and 'config-file' inputs" ); @@ -149338,7 +149338,7 @@ async function determineUserConfig(action, tempDir, inputs) { inputs.apiDetails, tempDir ); - const mergedConfig = mergeUserConfigs( + const mergedConfig = mergeDefaultSetupAndUserConfigs( action.logger, fromConfigInput, fromConfigFile diff --git a/src/config-utils.ts b/src/config-utils.ts index 085881c95..2eb01da01 100644 --- a/src/config-utils.ts +++ b/src/config-utils.ts @@ -27,7 +27,7 @@ import { calculateAugmentation, ExcludeQueryFilter, generateCodeScanningConfig, - mergeUserConfigs, + mergeDefaultSetupAndUserConfigs, parseUserConfig, UserConfig, } from "./config/db-config"; @@ -1036,7 +1036,8 @@ export async function determineUserConfig( // 1. A `config` or `config-file` input is provided, but not both: use the provided one. // 2. Both are provided and we are in an advanced workflow: ignore the `config-file` input. // 3. Both are provided and we are in Default Setup: the `config` input uses a limited - // set of options, which are supported by `mergeUserConfigs`, and we merge the two configs. + // set of options, which are supported by `mergeDefaultSetupAndUserConfigs`, + // and we merge the two configs. if (inputs.configInput) { const computedConfigPath = userConfigFromActionPath(tempDir); @@ -1070,7 +1071,7 @@ export async function determineUserConfig( // Write the merged configuration to disk so that it can be loaded subsequently by // the CLI or other CodeQL Action steps. - const mergedConfig = mergeUserConfigs( + const mergedConfig = mergeDefaultSetupAndUserConfigs( action.logger, fromConfigInput, fromConfigFile, diff --git a/src/config/db-config.test.ts b/src/config/db-config.test.ts index 4d523ad0a..5783e3a24 100644 --- a/src/config/db-config.test.ts +++ b/src/config/db-config.test.ts @@ -490,9 +490,9 @@ test("parseUserConfig - throws no ConfigurationError if validation should fail, ); }); -test("mergeUserConfigs - combines threat models", async (t) => { +test("mergeDefaultSetupAndUserConfigs - combines threat models", async (t) => { const logger = new RecordingLogger(); - const result = dbConfig.mergeUserConfigs( + const result = dbConfig.mergeDefaultSetupAndUserConfigs( logger, { "threat-models": ["a", "b"] }, { "threat-models": ["local", "remote"] }, @@ -505,9 +505,13 @@ test("mergeUserConfigs - combines threat models", async (t) => { } }); -test("mergeUserConfigs - warns if user-supplied config contains default setup key", async (t) => { +test("mergeDefaultSetupAndUserConfigs - warns if user-supplied config contains default setup key", async (t) => { const logger = new RecordingLogger(); - const result = dbConfig.mergeUserConfigs(logger, {}, { "default-setup": {} }); + const result = dbConfig.mergeDefaultSetupAndUserConfigs( + logger, + {}, + { "default-setup": {} }, + ); // User-supplied value is ignored. t.deepEqual(result, {}); @@ -520,12 +524,12 @@ test("mergeUserConfigs - warns if user-supplied config contains default setup ke ); }); -test("mergeUserConfigs - keeps default setup key from 'config' input", async (t) => { +test("mergeDefaultSetupAndUserConfigs - keeps default setup key from 'config' input", async (t) => { const logger = new RecordingLogger(); const expected: dbConfig.DefaultSetupConfig = { org: { "model-packs": ["some-pack"] }, }; - const result = dbConfig.mergeUserConfigs( + const result = dbConfig.mergeDefaultSetupAndUserConfigs( logger, { "default-setup": expected }, {}, @@ -542,14 +546,18 @@ test("mergeUserConfigs - keeps default setup key from 'config' input", async (t) ); }); -test("mergeUserConfigs - keeps other properties from user-supplied configuration", async (t) => { +test("mergeDefaultSetupAndUserConfigs - keeps other properties from user-supplied configuration", async (t) => { const logger = new RecordingLogger(); const configFile: dbConfig.UserConfig = { "query-filters": [{ exclude: { a: "b" } }], "paths-ignore": ["path"], }; - const result = dbConfig.mergeUserConfigs(logger, {}, configFile); + const result = dbConfig.mergeDefaultSetupAndUserConfigs( + logger, + {}, + configFile, + ); t.deepEqual(result, configFile); }); diff --git a/src/config/db-config.ts b/src/config/db-config.ts index c24994476..612a26a24 100644 --- a/src/config/db-config.ts +++ b/src/config/db-config.ts @@ -75,7 +75,7 @@ export interface UserConfig { * @param fromConfigFile The user-supplied configuration. * @returns The combination of both configuration files. */ -export function mergeUserConfigs( +export function mergeDefaultSetupAndUserConfigs( logger: Logger, fromConfigInput: UserConfig, fromConfigFile: UserConfig,