Skip to content

New command: expose --cache-cleanup=overlay base cache cleaning #4082

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

d10c
Copy link
Contributor

@d10c d10c commented Jul 21, 2025

Add new command "CodeQL: Trim Overlay Base Cache" that returns a database to the state prior to overlay evaluation, leaving only base predicates and types that may later be referenced during overlay evaluation.

Considerations:

  • Requires a recent enough query server. Should I hide this command behind a version check, or just let it fail on an older CLI?
  • I've tested this locally using a compatible build that hasn't been released yet. I suppose it means I can't add automated tests until that build is released. Should I add tests?

@d10c d10c force-pushed the d10c/cache-cleanup-overlay branch 3 times, most recently from 66df4c2 to 82df605 Compare July 23, 2025 09:33
@d10c d10c marked this pull request as ready for review July 23, 2025 10:30
@Copilot Copilot AI review requested due to automatic review settings July 23, 2025 10:30
@d10c d10c requested review from a team as code owners July 23, 2025 10:30
Copy link

@Copilot 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 adds a new command "CodeQL: Trim Overlay Base Cache" to expose the --cache-cleanup=overlay functionality for cleaning base cache data. The command allows users to return a database to the state prior to overlay evaluation, keeping only base predicates and types needed for future overlay evaluation.

Key Changes:

  • Implements new trimOverlayBaseCache command with corresponding message type and query server method
  • Adds UI integration through command registration and handler implementation
  • Updates package.json to expose the command in VS Code's command palette

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
extensions/ql-vscode/src/query-server/query-runner.ts Adds trimOverlayBaseCacheInDatabase method to handle the new cache trimming operation
extensions/ql-vscode/src/query-server/messages.ts Defines the trimOverlayBaseCache request type for communication with the query server
extensions/ql-vscode/src/databases/local-databases-ui.ts Registers command and implements handler for the new trim overlay base cache functionality
extensions/ql-vscode/src/common/commands.ts Adds type definition for the new command
extensions/ql-vscode/package.json Exposes the new command in VS Code's command palette
extensions/ql-vscode/CHANGELOG.md Documents the new feature addition

@d10c d10c force-pushed the d10c/cache-cleanup-overlay branch from 4922bbf to 380277d Compare July 23, 2025 14:05
@d10c d10c requested a review from cklin July 23, 2025 14:44
@koesie10
Copy link
Member

  • Requires a recent enough query server. Should I hide this command behind a version check, or just let it fail on an older CLI?

I think it would make sense to add this command behind a version check, although it would be even better to hide it behind a CLI feature (one that is returned in codeql version --format json). I see that the CLI PR hasn't been merged yet, so I think it would be best to add the feature in there. Then I think the best way to check this feature would be using something like:

cliServer.addVersionChangedListener((version) => {
  void app.commands.execute(
    "setContext",
    "codeQL.cliFeatures.yourFeatureName",
    version?.features?.yourFeatureName ?? false,
  );
});

You can then access this context in the when expression in package.json.

  • I've tested this locally using a compatible build that hasn't been released yet. I suppose it means I can't add automated tests until that build is released. Should I add tests?

If you can add tests, I think that would make sense. Once your PR is included in the nightly build, you should already be able to test it there, and based on when the PR is merged you can probably also determine which actual version it will be part of to add an actual version check.

@d10c d10c force-pushed the d10c/cache-cleanup-overlay branch from 380277d to 135be43 Compare July 24, 2025 12:26
@d10c
Copy link
Contributor Author

d10c commented Jul 24, 2025

I've added a VSCode context variable for all the CLI features, but if that's too complicated, I can change it back to just the new CLI feature that we use.

@d10c
Copy link
Contributor Author

d10c commented Jul 24, 2025

I'm fine with merging the query server changes first, so that we can include an integration test in this PR.

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.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy