Skip to content

Conversation

@mbg
Copy link
Member

@mbg mbg commented Oct 12, 2025

Classifies two additional types of errors as ConfigurationErrors:

  • Invalid config files
  • Missing query files

Best reviewed commit-by-commit.

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.

Which use cases does this change impact?

  • Advanced setup - Impacts users who have custom workflows.
  • Default setup - Impacts users who use default setup.
  • Code Scanning - Impacts Code Scanning (i.e. analysis-kinds: code-scanning).
  • Code Quality - Impacts Code Quality (i.e. analysis-kinds: code-quality).
  • GHES - Impacts GitHub Enterprise Server.

How did/will you validate this change?

  • Unit tests - I am depending on unit test coverage (i.e. tests in .test.ts files).
  • End-to-end tests - I am depending on PR checks (i.e. tests in pr-checks).

If something goes wrong after this change is released, what are the mitigation and rollback strategies?

  • Rollback - Change can only be disabled by rolling back the release or releasing a new version with a fix.

How will you know if something goes wrong after this change is released?

  • Telemetry - I rely on existing telemetry or have made changes to the telemetry.
    • Dashboards - I will watch relevant dashboards for issues after the release. Consider whether this requires this change to be released at a particular time rather than as part of a regular release.
    • Alerts - New or existing monitors will trip if something goes wrong with this change.

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.

@mbg mbg requested a review from henrymercer October 12, 2025 12:30
@mbg mbg self-assigned this Oct 12, 2025
@mbg mbg requested a review from a team as a code owner October 12, 2025 12:30
Copilot AI review requested due to automatic review settings October 12, 2025 12:30
Copy link
Contributor

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 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

@mbg mbg force-pushed the mbg/errors/more-user-errors branch from 6aa2711 to c71b45c Compare October 12, 2025 12:35
@mbg mbg force-pushed the mbg/errors/more-user-errors branch 2 times, most recently from e2b15e9 to 7987564 Compare October 17, 2025 13:24
@mbg mbg force-pushed the mbg/errors/more-user-errors branch from 27481bb to 9ce56a2 Compare October 17, 2025 14:11
Copy link
Contributor

@henrymercer henrymercer left a comment

Choose a reason for hiding this comment

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

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.

@mbg mbg merged commit 9b0ac1c into main Oct 20, 2025
242 checks passed
@mbg mbg deleted the mbg/errors/more-user-errors branch October 20, 2025 18:32
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.

3 participants