Skip to content

Conversation

@fmeum
Copy link
Collaborator

@fmeum fmeum commented Jan 5, 2026

Ensures that files under repo contents cache entries are not reported as missing after the cache has been deleted while the Bazel server is running. See the long comment in RepositoryFetchFunction for why this happens and how it is fixed.

Fixes #26450

@fmeum fmeum force-pushed the 26450-cleaner branch 5 times, most recently from e4eaa49 to 385b89c Compare January 5, 2026 12:15
@fmeum fmeum changed the title WIP: Fix repo contents cache staleness Fix repo contents cache FileValue staleness Jan 5, 2026
@fmeum fmeum force-pushed the 26450-cleaner branch 6 times, most recently from ba07bed to f4e3f67 Compare January 5, 2026 12:53
@fmeum fmeum force-pushed the 26450-cleaner branch 6 times, most recently from 8604933 to a89af2b Compare January 5, 2026 16:08
@fmeum fmeum marked this pull request as ready for review January 5, 2026 16:42
@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 Jan 5, 2026
Copy link
Member

@Wyverald Wyverald left a comment

Choose a reason for hiding this comment

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

I still don't fully understand which part of this PR made the repo contents cache dir special. Is it just the DirtinessCheckerUtils::isCacheableType change?

@fmeum
Copy link
Collaborator Author

fmeum commented Jan 6, 2026

re the second point: the original comment says "The only way other than external repositories for external source files ...". That doesn't seem wrong? The repo contents cache is only usable through external repos after all.

That depends on how strictly one interprets this: I read it as "The only way other than external repository directories...", which used to be true, but no longer is since the repo contents cache entries don't live under such directories (although of course they are reachable through them via symlinks). Ignoring that part, the conclusion "So the set of external files is small." is definitely wrong now since the repo contents cache file contributes a large number of EXTERNAL_OTHER files.

@fmeum
Copy link
Collaborator Author

fmeum commented Jan 6, 2026

I still don't fully understand which part of this PR made the repo contents cache dir special. Is it just the DirtinessCheckerUtils::isCacheableType change?

It's really just that (plus the switch to FileStateValue).

@fmeum fmeum requested a review from Wyverald January 6, 2026 10:40
@Wyverald
Copy link
Member

Wyverald commented Jan 6, 2026

re the second point: the original comment says "The only way other than external repositories for external source files ...". That doesn't seem wrong? The repo contents cache is only usable through external repos after all.

That depends on how strictly one interprets this: I read it as "The only way other than external repository directories...", which used to be true, but no longer is since the repo contents cache entries don't live under such directories (although of course they are reachable through them via symlinks).

I think that's a bit uncharitable -- I don't think we call $outputBase/external "external repository directories". "External repositories" is simply the name of the feature that allows you to define repos etc. But that doesn't really matter because...

Ignoring that part, the conclusion "So the set of external files is small." is definitely wrong now since the repo contents cache file contributes a large number of EXTERNAL_OTHER files.

That I agree with. In fact it might have already been wrong before; any files pointed to by a local_repository would have been EXTERNAL_OTHER, and this would have included bazel_tools.

@Wyverald Wyverald added awaiting-PR-merge PR has been approved by a reviewer and is ready to be merge internally and removed awaiting-review PR is awaiting review from an assigned reviewer labels Jan 6, 2026
@copybara-service copybara-service bot closed this in 7019132 Jan 8, 2026
@github-actions github-actions bot removed the awaiting-PR-merge PR has been approved by a reviewer and is ready to be merge internally label Jan 8, 2026
Wyverald pushed a commit that referenced this pull request Jan 8, 2026
Ensures that files under repo contents cache entries are not reported as missing after the cache has been deleted while the Bazel server is running. See the long comment in `RepositoryFetchFunction` for why this happens and how it is fixed.

Fixes #26450

Closes #28147.

PiperOrigin-RevId: 853622194
Change-Id: Ifba953b72258030e0a640ac49947ac5c5fc7620a
github-merge-queue bot pushed a commit that referenced this pull request Jan 8, 2026
Ensures that files under repo contents cache entries are not reported as
missing after the cache has been deleted while the Bazel server is
running. See the long comment in `RepositoryFetchFunction` for why this
happens and how it is fixed.

Fixes #26450

Closes #28147.

PiperOrigin-RevId: 853622194
Change-Id: Ifba953b72258030e0a640ac49947ac5c5fc7620a

Co-authored-by: Fabian Meumertzheim <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Starting with Bazel 8.3.0, archive_override removes all files from the archive root

2 participants