Skip to content

Implement cache-aware bundle optimization - #23

Merged
nicolaswill merged 3 commits into
mainfrom
nicolaswill-cache-aware-bundles
Jul 27, 2026
Merged

Implement cache-aware bundle optimization#23
nicolaswill merged 3 commits into
mainfrom
nicolaswill-cache-aware-bundles

Conversation

@nicolaswill

Copy link
Copy Markdown
Contributor
  • Catalog of known-good bundles + prebuilt per-language compilation caches published as release assets.
  • Source bundle identified by SHA-256 (archive) or pack fingerprint (dir), matched to the catalog, cache downloaded + verified, handed to codeql pack create --compilation-cache=.
  • New: cache.py, cache_cli.py (codeql-bundle-cache), codeql-compilation-caches.yml, supported-codeql-bundles.json + schema as package data.
  • New flags: --cache-dir, --cache-manifest, --no-compilation-cache.
  • --threads respected on every compile path: pack create via codeql.threads (default 0), and codeql-bundle-cache build --threads for both the cache build and its verification. Standalone verify* pins 0 (all cores) — one representative query.
  • Unknown bundle / unreachable catalog / missing packaged resource → warn, continue uncached. Catalog-listed bundle missing a target → hard fail; publish can't emit a partial catalog since a failed language blocks it.
  • e2e via the toolkit's frozen binary, real cache hit: java-queries 28m13s → 19m57s, whole qlt ... install --custom-bundle 43m55s → 29m33s. Partial reuse expected, that workspace extends codeql/java-all.
  • Version 0.5.0. Cut v0.5.0 after merge — the toolkit pins it, and it unblocks codeql-compilation-caches.yml.

Add an authoritative supported-bundle catalog, local cache tooling, verified per-language cache downloads, and release automation with cross-platform validation.
Copilot AI review requested due to automatic review settings July 27, 2026 23:35
@nicolaswill
nicolaswill requested a review from a team as a code owner July 27, 2026 23:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 cache-aware optimization layer to codeql-bundle by introducing a supported-bundle catalog and per-language compilation-cache assets, along with a new codeql-bundle-cache CLI and GitHub Actions automation to build/verify/publish those caches.

Changes:

  • Add catalog + cache resolution/download/verification plumbing and integrate it into the custom bundle build path.
  • Introduce codeql-bundle-cache CLI for planning, building, verifying caches, and updating the catalog.
  • Add unit tests plus CI workflows to run tests and to automate compilation-cache releases.
Show a summary per file
File Description
tests/workspace/cpp/foo-customizations/qlpack.yml Relax test workspace dependency constraints for codeql/cpp-all.
tests/workspace/cpp/aa/qlpack.yml Relax test workspace dependency constraints for codeql/cpp-all.
tests/test_codeql.py Adds tests asserting explicit compilation-cache flags are used for pack create and query compile.
tests/test_cache.py Adds coverage for catalog loading, bundle source resolution, safe extraction, and cache download/install behaviors.
tests/test_cache_targets.py Adds tests for determining compilation-cache targets from pack dependency graphs.
tests/test_cache_cli.py Adds tests for cache CLI commands (prune, build plan validation, catalog updates).
README.md Documents new bundle source forms, compilation-cache behavior, cache CLI usage, and automation workflow.
pyproject.toml Bumps version to 0.5.0 and registers the new codeql-bundle-cache entrypoint.
CONTRIBUTING.md Adds local unit test invocation guidance and notes on local cache-release development.
codeql_bundle/supported-codeql-bundles.schema.json Adds JSON schema for the supported bundle catalog format.
codeql_bundle/supported-codeql-bundles.json Adds the initial (empty) supported bundle catalog as packaged data.
codeql_bundle/helpers/codeql.py Adds streaming execution, compilation-cache options for pack create, and a new query_compile helper.
codeql_bundle/helpers/bundle.py Integrates cache-aware behaviors into bundling flow and adds pack fingerprinting + target selection utilities.
codeql_bundle/cli.py Extends --bundle to accept path/URL/release tag and wires in catalog/cache resolution flags.
codeql_bundle/cache.py Introduces catalog, source resolution, download/verification, safe extraction, and cache installation primitives.
codeql_bundle/cache_cli.py Implements codeql-bundle-cache CLI for planning/building/verifying/publishing caches and catalog updates.
.github/workflows/test.yml Adds a unit test workflow (Python 3.11/3.12).
.github/workflows/codeql-compilation-caches.yml Adds automation to build/verify/publish compilation caches and open catalog update PRs.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 18/18 changed files
  • Comments generated: 2
  • Review effort level: Low

Comment thread codeql_bundle/cache.py
Comment thread codeql_bundle/cache_cli.py Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 27, 2026 23:51
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@nicolaswill
nicolaswill merged commit e66dc52 into main Jul 27, 2026
5 checks passed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review details

Comments suppressed due to low confidence (1)

codeql_bundle/cache.py:906

  • Same issue as above: touching install_path (a directory) won’t update the entry’s timestamp for pruning/retention logic. Touch the marker file instead so cache usage extends retention.
                    _touch(install_path)
  • Files reviewed: 18/18 changed files
  • Comments generated: 3
  • Review effort level: Low

Comment on lines +117 to +119
for line in process.stdout:
output.append(line)
logger.info(line.rstrip())
Comment on lines +120 to +124
return subprocess.CompletedProcess(
command_args,
process.wait(),
stdout="",
stderr="".join(output),
Comment thread codeql_bundle/cache.py
if self._is_installed(
marker_path, installed_cache_path, target, cache.asset.sha256
):
_touch(install_path)
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