Add --no-cache-at-frontier to run-queries#1374
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds the --no-evaluate-as-overlay flag to the CodeQL CLI's database run-queries command as an experimental workaround for errors that occur when overlay databases have been uploaded for repositories. This is an internal action used by GitHub's multi-repository variant analysis feature.
Changes:
- Added
--no-evaluate-as-overlayflag to therunQueryfunction's call tocodeql database run-queries - Updated both the TypeScript source and the generated JavaScript bundle
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/codeql.ts | Added --no-evaluate-as-overlay flag to the database run-queries command in the runQuery function |
| dist/query.js | Generated bundle reflecting the TypeScript source changes |
Comments suppressed due to low confidence (2)
src/codeql.ts:74
- The existing tests for runQuery in src/codeql.test.ts do not verify the command-line flags passed to the CodeQL CLI. Adding this flag unconditionally could affect query behavior, but there's no test coverage to validate that:
- The flag is actually being passed correctly
- Queries still execute successfully with this flag
- The flag achieves the intended effect (working around overlay database errors)
Consider adding a test that verifies the flag is passed when calling database run-queries, or at minimum, ensure the existing integration tests pass with this change.
"--no-evaluate-as-overlay",
src/codeql.ts:74
- There is no documentation explaining what the
--no-evaluate-as-overlayflag does or why it's needed. This makes the code harder to maintain and understand. Consider adding a comment above this line that:
- Explains what this flag does
- References the issue or error it's intended to fix
- Mentions that this is experimental (as noted in the PR description)
- Links to relevant CodeQL CLI documentation if available
For example:
// Experimental: Disable evaluation as overlay to work around errors when
// overlay databases have been uploaded for repositories.
// See: [link to issue/documentation]
"--no-evaluate-as-overlay",
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/codeql.ts
Outdated
| await codeql.run([ | ||
| "database", | ||
| "run-queries", | ||
| "--no-evaluate-as-overlay", |
There was a problem hiding this comment.
This experimental flag is being added unconditionally to all query executions. Since the PR description mentions this is an "experiment to potentially work around an error when overlay databases have been uploaded," consider making this configurable via the existing feature flags system (Instructions.features).
This would allow:
- The flag to be enabled/disabled without requiring a code change and redeployment
- A/B testing to verify it solves the overlay database issue
- Easy rollback if unexpected issues arise
For example, you could check for a feature flag like no_evaluate_as_overlay before adding this flag to the command.
This issue also appears in the following locations of the same file:
- line 74
- line 74
See below for a potential fix:
const runQueriesArgs = [
"database",
"run-queries",
];
// Enable the experimental "--no-evaluate-as-overlay" flag by default, but
// allow it to be disabled without a code change by setting the environment
// variable NO_EVALUATE_AS_OVERLAY to "false".
if (process.env.NO_EVALUATE_AS_OVERLAY !== "false") {
runQueriesArgs.push("--no-evaluate-as-overlay");
}
runQueriesArgs.push(
`--ram=${getMemoryFlagValue().toString()}`,
"--additional-packs",
queryPack.path,
"--",
databasePath,
queryPack.name,
);
await codeql.run(runQueriesArgs);
05f77e9 to
fa4d09c
Compare
This is to work around an error when overlay databases have been uploaded for repositories.
Tested with a MRVA run on repos that previously failed to analyse and this flag allowed the queries to succeed.