Skip to content

Commit 966f3c3

Browse files
henrymercerCopilot
andcommitted
Say that the Default Setup config schema reflects what Default Setup is known to send
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent 711f3bf commit 966f3c3

2 files changed

Lines changed: 9 additions & 8 deletions

File tree

‎src/config/db-config.ts‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,9 @@ export interface UserConfig {
8787
}
8888

8989
/**
90-
* A subset of the `UserConfig` schema that is used by Default Setup. None of these properties may
91-
* add queries, since a per-language CodeQL bundle can be used with a `config` input that only sets
92-
* them.
90+
* A subset of the `UserConfig` schema that is known to be used by Default Setup. None of these
91+
* properties may add queries, since a per-language CodeQL bundle can be used with a `config` input
92+
* that only sets them.
9393
*/
9494
const DEFAULT_SETUP_CONFIG_SCHEMA = {
9595
"threat-models": json.optional(json.array(json.string)),
@@ -99,8 +99,9 @@ const DEFAULT_SETUP_CONFIG_SCHEMA = {
9999
} as const satisfies json.Schema;
100100

101101
/**
102-
* Returns whether `config` is a mapping that only sets the properties that Default Setup sets in
103-
* the `config` input, to valid values.
102+
* Returns whether `config` matches what we expect Default Setup to send in the `config` input: a
103+
* mapping that only sets properties in `DEFAULT_SETUP_CONFIG_SCHEMA`, with values of the expected
104+
* types.
104105
*/
105106
export function matchesDefaultSetupConfigSchema(config: UserConfig): boolean {
106107
// Unless validation is enabled, `parseUserConfig` doesn't check that the YAML is a mapping.

‎src/per-language-bundles.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ export interface QueryConfigInputs {
5858
* query packs are downloaded together with their dependencies.
5959
*
6060
* Any configuration file is assumed to configure such queries, since reading it may need file or API
61-
* access. So is the `config` input, unless it only sets the properties that default setup sets (see
62-
* `matchesDefaultSetupConfigSchema`).
61+
* access. So is the `config` input, unless it only sets the properties that default setup is known
62+
* to set (see `matchesDefaultSetupConfigSchema`).
6363
*
6464
* @throws A `ConfigurationError` if the `queries` input or the `github-codeql-extra-queries`
6565
* repository property is a '+' with no queries after it, unless an input that's checked earlier
@@ -76,7 +76,7 @@ export function getOtherLanguagePacksReason(
7676
}
7777

7878
// The `config` input can configure queries in the same way as a configuration file. The
79-
// properties that default setup sets, listed in `DEFAULT_SETUP_CONFIG_SCHEMA` in
79+
// properties that default setup is known to set, listed in `DEFAULT_SETUP_CONFIG_SCHEMA` in
8080
// `config/db-config.ts`, don't add queries.
8181
if (
8282
inputs.configInput !== undefined &&

0 commit comments

Comments
 (0)