Skip to content

Disable the repo contents cache in the integration test harnesses - #31263

Closed
fmeum wants to merge 1 commit into
bazelbuild:masterfrom
fmeum:fix-reverse-dependency-test
Closed

fmeum wants to merge 1 commit into
bazelbuild:masterfrom
fmeum:fix-reverse-dependency-test

Conversation

@fmeum

@fmeum fmeum commented Sep 22, 2026

Copy link
Copy Markdown
Collaborator

Description

The repo contents cache defaults to a directory under the repository cache. The Python, shell and blackbox test harnesses point --repository_cache at REPOSITORY_CACHE on CI, which is shared between all tests and test attempts on a machine, so they unintentionally shared the repo contents cache as well.

The harnesses now disable the repo contents cache globally, matching what several tests already did for themselves, and those opt-outs are removed. The tests that exercise it opt in explicitly: repo_contents_cache_test appends its cache to the harness bazelrc, which takes precedence over the workspace .bazelrc it used before, and testForceFetchWithRepoCache as well as testReverseDependencyDirection use a private cache outside of the workspace.

Two cases of external_integration_test had come to depend on the cache without being about it. test_cached_across_server_restart printed the recorded inputs of the cache entry, which the repo contents cache commit had substituted for the repo's marker file; it prints the marker file again. test_cache_hit_reported asserted on cache hit, which also matches the "N action cache hit" build summary that only shows up without the repo contents cache, since the repo is then actually re-fetched and its actions re-checked; it now asserts on the wording of the report it is about.

Motivation

Discovered as bazel_module_test.testReverseDependencyDirection failed on every retry: the first attempt passes this test and fails another one on a Windows-only install base issue, and the retries then find the test's reproducible repos in the shared cache and never fetch them, so the "JUST FETCHED" output the test asserts on is missing.

Build API Changes

No

Release Notes

RELNOTES: None

@fmeum fmeum changed the title Use a private repo contents cache in testReverseDependencyDirection Disable the repo contents cache in the integration test harnesses Sep 22, 2026
@fmeum
fmeum force-pushed the fix-reverse-dependency-test branch from 90239af to 43107eb Compare September 22, 2026 17:58
The repo contents cache defaults to a directory under the repository cache. The Python, shell and blackbox test harnesses point `--repository_cache` at `REPOSITORY_CACHE` on CI, which is shared between all tests and test attempts on a machine, so they unintentionally shared the repo contents cache as well. This made `bazel_module_test.testReverseDependencyDirection` fail on every retry of a Windows shard: the first attempt fetches its reproducible repos into the shared cache, the retry finds them there and never fetches, and the test then fails on the missing "JUST FETCHED" output.

The harnesses now disable the repo contents cache, matching what several tests already did for themselves, and those opt-outs are removed. The tests that exercise the cache opt in explicitly: `repo_contents_cache_test` appends its cache to the harness bazelrc, which takes precedence over the workspace `.bazelrc` it used before, and `testForceFetchWithRepoCache` as well as `testReverseDependencyDirection` use a private cache outside of the workspace.

Two cases of `external_integration_test` had come to depend on the cache without being about it. `test_cached_across_server_restart` printed the recorded inputs of the cache entry, which the repo contents cache commit had substituted for the repo's marker file; it prints the marker file again. `test_cache_hit_reported` asserted on `cache hit`, which also matches the "N action cache hit" build summary that only shows up without the repo contents cache, since the repo is then actually re-fetched and its actions re-checked; it now asserts on the wording of the report it is about.
@fmeum
fmeum force-pushed the fix-reverse-dependency-test branch from 43107eb to 389c1b5 Compare September 22, 2026 18:35
@fmeum
fmeum marked this pull request as ready for review September 22, 2026 19:50
@github-actions github-actions Bot added team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. awaiting-review PR is awaiting review from an assigned reviewer labels Sep 22, 2026
@meteorcloudy meteorcloudy added copybara:import Trigger copybara to import the PR and removed awaiting-review PR is awaiting review from an assigned reviewer labels Sep 23, 2026
copybara-service Bot pushed a commit that referenced this pull request Sep 23, 2026
### Description

Six other cases of `external_integration_test` create an archive with exactly the same contents as `test_distdir_option_not_sticky`. Zip stores modification times with a granularity of two seconds, so when two of them run within the same second in different shards, the archives are byte-identical and thus have the same checksum. Every shard on a CI machine shares the same repository cache, so as soon as the other case has fetched its copy, the build without `--distdir` in this test finds the archive in the cache and succeeds although it is expected to fail.

The test now adds a file with its own temporary directory to the archive so that no other test or attempt can have cached it.

### Motivation

`test_distdir_option_not_sticky` failed on the first attempt of a Linux shard of #31263 and passed on the retry, and it fails the same way locally when all shards of the test start at the same time with a shared `REPOSITORY_CACHE`. The build that is expected to fail fetches the repo without any download, which is only possible with a repository cache hit.

### Build API Changes

No

### Release Notes

RELNOTES: None

Closes #31266

COPYBARA_INTEGRATE_REVIEW=#31266 from fmeum:fix-distdir-flake 7ce06b0
PiperOrigin-RevId: 986957565
Change-Id: I9bf7ba48d7bcce3913731b43a5e8b1ed7f5b1961
@fmeum
fmeum deleted the fix-reverse-dependency-test branch September 24, 2026 06:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

copybara:import Trigger copybara to import the PR team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants