Handle user errors for invalid UserConfigs and missing query files#3203
Merged
Handle user errors for invalid UserConfigs and missing query files#3203
UserConfigs and missing query files#3203Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR improves error handling for CodeQL configuration by classifying invalid config files and missing query files as ConfigurationErrors. The changes introduce JSON schema validation for config files and better error classification to provide users with clearer feedback when their configurations are malformed.
- Adds JSON schema validation for user config files with structured error reporting
- Expands CLI error classification to include missing query file scenarios
- Updates type definitions to better handle query input formats
Reviewed Changes
Copilot reviewed 17 out of 19 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/error-messages.ts |
Adds new error message functions for config file parsing and validation errors |
src/db-config-schema.json |
Defines comprehensive JSON schema for CodeQL database configuration validation |
src/config/db-config.ts |
Implements parseUserConfig function with JSON schema validation and updates type definitions |
src/config/db-config.test.ts |
Adds tests for the new parseUserConfig function covering valid YAML and error cases |
src/config-utils.ts |
Updates config loading to use the new parseUserConfig function for better error handling |
src/cli-errors.ts |
Expands error pattern matching to include missing query file scenarios |
src/cli-errors.test.ts |
Adds test case for unknown query file error classification |
src/status-report.ts |
Updates query rendering to use new renderQueryInput helper function |
lib/* |
Generated JavaScript files reflecting the TypeScript changes |
6aa2711 to
c71b45c
Compare
henrymercer
reviewed
Oct 13, 2025
e2b15e9 to
7987564
Compare
- Throws a `ConfigurationError` if parsing the YAML fails - Add a couple of tests for it
27481bb to
9ce56a2
Compare
henrymercer
reviewed
Oct 17, 2025
henrymercer
approved these changes
Oct 17, 2025
Contributor
henrymercer
left a comment
There was a problem hiding this comment.
The comments I made earlier were valid for instructions in general, but the CLI is actually more strict about instructions included in a UserConfig. So I think this is good to go as is.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Classifies two additional types of errors as
ConfigurationErrors:Best reviewed commit-by-commit.
Risk assessment
For internal use only. Please select the risk level of this change:
Which use cases does this change impact?
analysis-kinds: code-scanning).analysis-kinds: code-quality).How did/will you validate this change?
.test.tsfiles).pr-checks).If something goes wrong after this change is released, what are the mitigation and rollback strategies?
How will you know if something goes wrong after this change is released?
Merge / deployment checklist