Bug Report
Summary
codeql_query_run does not automatically cache results for @kind problem or @kind path-problem queries unless the format parameter is explicitly provided. Since these query kinds have well-defined output formats (SARIF), results should be auto-cached without requiring the caller to specify format.
Steps to Reproduce
- Run a
@kind problem query without specifying format:
codeql_query_run --database=<db> --query=ExampleQuery1.ql
- Call
query_results_cache_lookup — returns cached: false.
- Re-run with
format: sarif-latest:
codeql_query_run --database=<db> --query=ExampleQuery1.ql --format=sarif-latest
- Call
query_results_cache_lookup — returns cached: true.
Root Cause
In server/src/lib/result-processor.ts, the processQueryRunResults function returns early at lines 167-169 when neither format nor evaluationFunction is specified:
// If no format or evaluationFunction specified, return as-is
if (!format && !evaluationFunction) {
return result;
}
This skips the entire caching path (line ~220+), which is gated behind BQRS interpretation.
Expected Behavior
For @kind problem and @kind path-problem queries, the result processor should auto-detect the query kind from metadata and default to sarif-latest interpretation, ensuring results are always cached.
Actual Behavior
Results are only cached when format is explicitly provided by the caller. Without it, the BQRS file is produced but never interpreted or cached.
Suggested Fix
In processQueryRunResults, when no format is specified, read the query metadata (@kind) and auto-set format to sarif-latest for problem / path-problem queries before the early-return check.
Bug Report
Summary
codeql_query_rundoes not automatically cache results for@kind problemor@kind path-problemqueries unless theformatparameter is explicitly provided. Since these query kinds have well-defined output formats (SARIF), results should be auto-cached without requiring the caller to specifyformat.Steps to Reproduce
@kind problemquery without specifyingformat:query_results_cache_lookup— returnscached: false.format: sarif-latest:query_results_cache_lookup— returnscached: true.Root Cause
In
server/src/lib/result-processor.ts, theprocessQueryRunResultsfunction returns early at lines 167-169 when neitherformatnorevaluationFunctionis specified:This skips the entire caching path (line ~220+), which is gated behind BQRS interpretation.
Expected Behavior
For
@kind problemand@kind path-problemqueries, the result processor should auto-detect the query kind from metadata and default tosarif-latestinterpretation, ensuring results are always cached.Actual Behavior
Results are only cached when
formatis explicitly provided by the caller. Without it, the BQRS file is produced but never interpreted or cached.Suggested Fix
In
processQueryRunResults, when noformatis specified, read the query metadata (@kind) and auto-setformattosarif-latestforproblem/path-problemqueries before the early-return check.