Repository navigation
perf(repo-policy-sync): reuse shared Bazel dependency downloads - #66
Open
AlexanderLanin wants to merge 2 commits into
Open
AlexanderLanin wants to merge 2 commits into
AlexanderLanin wants to merge 2 commits into
Conversation
AlexanderLanin
requested review from
MaximilianSoerenPollak,
dcalavrezo-qorix and
nradakovic
as code owners
November 2, 2026 17:11
There was a problem hiding this comment.
🟡 Changes recommended
The README overstates hook credential isolation because global Git URL rewrites, including token-bearing URLs, are still copied into the temporary home.
1 open issue
What changed in this PR
This PR reduces repeated Bazel downloads during policy application while preserving temporary command homes and selectively sharing cache configuration.
Changes:
- Adds a reference-repository cache warm-up job and restore-only caching for apply.
- Shares selected Bazel and Bazelisk cache settings with follow-up commands and pre-commit hooks.
- Documents cache behavior and adds regression coverage for cache sharing and environment isolation.
| File | Description |
|---|---|
repo_policy_sync/tests/test_cache.py |
Tests cache sharing, environment filtering, and temporary-home cleanup. |
repo_policy_sync/src/github.py |
Configures shared caches for pre-commit hooks. |
repo_policy_sync/src/engine.py |
Configures shared caches for follow-up commands. |
repo_policy_sync/src/cache.py |
Adds selective cache configuration for temporary homes. |
repo_policy_sync/README.md |
Documents cache setup, persistence, and warm-up failure behavior. |
.github/workflows/repo-policy-sync.yml |
Adds cache warm-up and restore steps with job-local dependency reuse. |
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Policy application repeatedly downloads Bazel and repository dependencies because
follow-up commands and pre-commit hooks run with fresh temporary home directories.
Reuse those downloads while retaining the isolated command environment.
Before apply, one job warms a shared repository download cache and Bazelisk cache
using reference_integration. The cache action uses that repository's lockfile for
its normal reset and save decisions. The existing apply job restores the caches
without saving its additions, so dependencies from every target do not accumulate
in the persisted cache. A failed warm-up remains visible but does not prevent
apply from using an older cache or downloading missing dependencies itself.
Import the selected cache configuration into each temporary home, including for
Bazel 8, and keep each repository's unpacked dependencies available across policies
and hook retries within the apply job. The workflow chooses its reference
repository; no new tool configuration setting is needed. Regression coverage
checks that follow-up commands and hooks share the selected cache settings while
filtering personal Bazel settings and token environment variables. Pre-commit
hooks still receive global Git URL rewrites for authenticated dependency downloads;
those URLs can contain credentials.
Change trigger: the policy apply job takes over an hour and therefore longer than the max app token lifetime