Skip to content

Materialize RRCC symlinks via prefetching - #28683

Closed
fmeum wants to merge 5 commits into
bazelbuild:masterfrom
fmeum:28575-materialize-by-prefetching
Closed

fmeum wants to merge 5 commits into
bazelbuild:masterfrom
fmeum:28575-materialize-by-prefetching

Conversation

@fmeum

@fmeum fmeum commented Feb 17, 2026 •

Copy link
Copy Markdown
Collaborator

Description

When using the remote repo contents cache, repo materialization now uses the same code path as local action input prefetching for symlinks. This ensures that each symlink is only materialized once and that there are no races in case symlinking is not atomic (on Windows with default settings).

Along the way, remove unreachable code from UploadManifest.

Motivation

Fixes #28575

Build API Changes

No

Checklist

  • I have added tests for the new use cases (if any).
  • I have updated the documentation (if applicable).

Release Notes

RELNOTES: None

@fmeum
fmeum force-pushed the 28575-materialize-by-prefetching branch 2 times, most recently from af09fdf to 49f4be9 Compare February 17, 2026 15:13
@fmeum
fmeum force-pushed the 28575-materialize-by-prefetching branch from 49f4be9 to b4be0f0 Compare February 25, 2026 09:21
@fmeum
fmeum force-pushed the 28575-materialize-by-prefetching branch from b4be0f0 to 544b00a Compare February 25, 2026 15:36
@fmeum
fmeum marked this pull request as ready for review February 26, 2026 09:32
@fmeum
fmeum requested review from a team, Wyverald and meteorcloudy as code owners February 26, 2026 09:32
@github-actions github-actions Bot added team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. team-Remote-Exec Issues and PRs for the Execution (Remote) team awaiting-review PR is awaiting review from an assigned reviewer labels Feb 26, 2026
@fmeum

fmeum commented Feb 26, 2026

Copy link
Copy Markdown
Collaborator Author

@Wyverald The Windows test requires support for dynamic deps for it to pass (it adds a watch since the symlink is a copy).

@fmeum

fmeum commented Feb 26, 2026

Copy link
Copy Markdown
Collaborator Author

@bazel-io fork 9.1.0

@iancha1992

Copy link
Copy Markdown
Contributor

@fmeum Could you please take a look at the CI failure? Thanks!

@fmeum

fmeum commented Mar 18, 2026

Copy link
Copy Markdown
Collaborator Author

@iancha1992 Those are expected (see #28683 (comment)) as this requires another PR to be merged first.

@Wyverald Wyverald left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I must admit that I don't really understand what this PR is doing, so I hyperfocused on the test...

@fmeum
fmeum force-pushed the 28575-materialize-by-prefetching branch from 78e7ccf to 56e84c1 Compare March 24, 2026 10:35
@fmeum
fmeum requested a review from Wyverald March 27, 2026 06:53
@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 Mar 31, 2026
@fmeum

fmeum commented Apr 1, 2026

Copy link
Copy Markdown
Collaborator Author

@Wyverald friendly ping

@iancha1992

Copy link
Copy Markdown
Contributor

@Wyverald friendly ping

@fmeum We're currently importing this :)

@copybara-service copybara-service Bot closed this in 90eb56e Apr 2, 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 Apr 2, 2026
bazel-io pushed a commit to bazel-io/bazel that referenced this pull request Apr 2, 2026
### Description
When using the remote repo contents cache, repo materialization now uses the same code path as local action input prefetching for symlinks. This ensures that each symlink is only materialized once and that there are no races in case symlinking is not atomic (on Windows with default settings).

Along the way, remove unreachable code from `UploadManifest`.

### Motivation
Fixes bazelbuild#28575

### Build API Changes

No

### Checklist

- [x] I have added tests for the new use cases (if any).
- [ ] I have updated the documentation (if applicable).

### Release Notes

RELNOTES: None

Closes bazelbuild#28683.

PiperOrigin-RevId: 893359962
Change-Id: If0eb64e41858a4b9298c2609d83160b0ecbfd451
@fmeum
fmeum deleted the 28575-materialize-by-prefetching branch April 3, 2026 20:08
iancha1992 pushed a commit to bazel-io/bazel that referenced this pull request Apr 7, 2026
### Description
When using the remote repo contents cache, repo materialization now uses the same code path as local action input prefetching for symlinks. This ensures that each symlink is only materialized once and that there are no races in case symlinking is not atomic (on Windows with default settings).

Along the way, remove unreachable code from `UploadManifest`.

### Motivation
Fixes bazelbuild#28575

### Build API Changes

No

### Checklist

- [x] I have added tests for the new use cases (if any).
- [ ] I have updated the documentation (if applicable).

### Release Notes

RELNOTES: None

Closes bazelbuild#28683.

PiperOrigin-RevId: 893359962
Change-Id: If0eb64e41858a4b9298c2609d83160b0ecbfd451
github-merge-queue Bot pushed a commit that referenced this pull request Apr 8, 2026
### Description
When using the remote repo contents cache, repo materialization now uses
the same code path as local action input prefetching for symlinks. This
ensures that each symlink is only materialized once and that there are
no races in case symlinking is not atomic (on Windows with default
settings).

Along the way, remove unreachable code from `UploadManifest`.

### Motivation
Fixes #28575

### Build API Changes

No

### Checklist

- [x] I have added tests for the new use cases (if any).
- [ ] I have updated the documentation (if applicable).

### Release Notes

RELNOTES: None

Closes #28683.

PiperOrigin-RevId: 893359962
Change-Id: If0eb64e41858a4b9298c2609d83160b0ecbfd451

Commit
90eb56e

Co-authored-by: Fabian Meumertzheim <[email protected]>
fmeum added a commit to fmeum/bazel that referenced this pull request Jun 26, 2026
When a remotely cached repo is partially materialized since it contains action
inputs, Skyframe provides the metadata of these inputs after following all
symlinks as it does for all source files. Since (chains of) symlinks need to be
preserved and materialized in the same way as if the repo rule ran locally or
was fully materialized as a dependency of another repo rule,
`AbstractActionInputPrefetcher` is changed to walk the full chain of symlinks
behind a prefetched external repo path and replant every link verbatim on the
host file system.

This proves very difficult to get right for repos with symlinks pointing into
the main repo as such symlinks would cross over into the host filesystem. For
this reason such symlinks now exclude a repo from being cached remotely. Note
that the local repo contents cache already doesn't cache such repos. Since main
repo files are readily available, this is considered a minor loss in usefulness
only.

8.x adaptation: the 8.x prefetcher uses an exec-path-based symlink model
(`resolveExecPath`, `execRoot()`, `FileArtifactValue#getMaterializationExecPath`)
rather than the master model (`getResolvedPath`, `execRoot` field). The
chain-walking is therefore re-expressed on that model: the `Symlink` record
becomes `(Path linkPath, PathFragment targetPath)` as upstream, but the
materialization case resolves `getMaterializationExecPath()` through
`resolveExecPath` instead of reading `getResolvedPath()`; the loop guard throws
`FileSymlinkLoopException(PathFragment)` (the 8.x constructor); and the 8.x
`CacheNotFoundException` rewinding `onErrorResumeNext` is preserved. Because the
exec root isn't available during external repository materialization, both
`getSymlinks` and `plantSymlink` detect external repo paths via the
`isUnderExternalRepoRoot` helper (introduced in the bazelbuild#28683 backport) instead of
`execRoot()`, which would otherwise NPE during materialization.

On the repo side, 8.x has no `RepositoryUtils` or merged
`RepositoryFetchFunction`, so the `ReplantSymlinksResult` record and the
main-repo-symlink exclusion are applied to `RepositoryFunction.replantSymlinks`
and the `RepositoryDelegatorFunction` caching path (where remote caching is now
gated on `safeForRemoteCache()` and local caching on `safeForLocalCache()`).
`VendorManager` keeps its existing private `replantSymlinks`, so the upstream
call-signature change there does not apply.

This commit also carries the three symlink-materialization tests added upstream
in bazelbuild#28683: on 8.x they only pass once this chain-walk change is in place, since
repo files are materialized lazily through `RemoteExternalOverlayFileSystem`
rather than fully on disk as on master.

Depends on the replant prerequisite (bazelbuild#28582) backported in the preceding slot.

Fixes bazelbuild#29656.
Fixes bazelbuild#29515.

Closes bazelbuild#29767.

PiperOrigin-RevId: 936532134
Change-Id: I48b63f6fd2d5f57e139175e3ed578d65f6abbd08
(cherry picked from commit c310e3e)
fmeum added a commit to fmeum/bazel that referenced this pull request Jul 1, 2026
When using the remote repo contents cache, repo materialization now uses the
same code path as local action input prefetching for symlinks. This ensures
that each symlink is only materialized once and that there are no races in case
symlinking is not atomic (on Windows with default settings).

Along the way, remove unreachable code from `UploadManifest`.

8.x adaptation: `AbstractActionInputPrefetcher` on 8.x resolves input paths via
the Bazel 8.x-specific `resolveExecPath(execPath)` helper (which avoids
evaluating the WORKSPACE-named exec root when possible) and exposes the exec
root through the `execRoot()` method rather than an `execRoot` field, so the new
symlink branch is expressed in those terms. Because `execRoot()` is not
available during external repository materialization, the branch detects
external repo paths via a new `isUnderExternalRepoRoot` helper (mirroring
`DirectoryTracker.setWritable`) instead of `!inputPath.startsWith(execRoot())`,
and reads the symlink target from `UnresolvedSymlinkArtifactValue#getSymlinkTarget`
(8.x has no `FileArtifactValue#getUnresolvedSymlinkTarget`). Only the
`FileStateType` import is added; the other imports touched upstream don't apply
because 8.x resolves `VirtualActionInput` to `actions.cache.VirtualActionInput`.

The three symlink-materialization tests added upstream are deferred to the
chains-of-symlinks backport (bazelbuild#29767): on 8.x, repo files are materialized lazily
through `RemoteExternalOverlayFileSystem`, and faithfully reproducing (chains
of) symlinks on disk only works with that later change, not with this commit's
single-link prefetching alone.

Fixes bazelbuild#28575.

Closes bazelbuild#28683.

PiperOrigin-RevId: 893359962
Change-Id: If0eb64e41858a4b9298c2609d83160b0ecbfd451
(cherry picked from commit 90eb56e)
fmeum added a commit to fmeum/bazel that referenced this pull request Jul 9, 2026
When using the remote repo contents cache, repo materialization now uses
the same code path as local action input prefetching for symlinks. This
ensures that each symlink is only materialized once and that there are no
races in case symlinking is not atomic (on Windows with default settings).
Along the way, remove unreachable code from `UploadManifest`.

Furthermore, when a remotely cached repo is partially materialized since it
contains action inputs, Skyframe provides the metadata of these inputs
after following all symlinks as it does for all source files. Since (chains
of) symlinks need to be preserved and materialized in the same way as if
the repo rule ran locally or was fully materialized as a dependency of
another repo rule, `AbstractActionInputPrefetcher` is changed to walk the
full chain of symlinks behind a prefetched external repo path and replant
every link verbatim on the host file system.

This proves very difficult to get right for repos with symlinks pointing
into the main repo as such symlinks would cross over into the host
filesystem. For this reason such symlinks now exclude a repo from being
cached remotely. Note that the local repo contents cache already doesn't
cache such repos. Since main repo files are readily available, this is
considered a minor loss in usefulness only.

This commit combines the backports of bazelbuild#28683 and bazelbuild#29767 into one: the
symlink-materialization tests added upstream in bazelbuild#28683 only pass on 8.x
once the chain-walk change from bazelbuild#29767 is in place, since repo files are
materialized lazily through `RemoteExternalOverlayFileSystem` rather than
fully on disk as on master.

8.x adaptation: `AbstractActionInputPrefetcher` on 8.x resolves input paths
via the Bazel 8.x-specific `resolveExecPath(execPath)` helper (which avoids
evaluating the WORKSPACE-named exec root when possible) and exposes the
exec root through the `execRoot()` method rather than an `execRoot` field,
so the new symlink handling is expressed in those terms. Because
`execRoot()` is not available during external repository materialization,
external repo paths are detected via a new `isUnderExternalRepoRoot`
helper (mirroring `DirectoryTracker.setWritable`) instead of
`!inputPath.startsWith(execRoot())`; both `getSymlinks` and `plantSymlink`
use it. The chain-walking is re-expressed on the exec-path-based symlink
model (`resolveExecPath`, `execRoot()`,
`FileArtifactValue#getMaterializationExecPath`) rather than the master
model (`getResolvedPath`, `execRoot` field): the `Symlink` record becomes
`(Path linkPath, PathFragment targetPath)` as upstream, but the
materialization case resolves `getMaterializationExecPath()` through
`resolveExecPath` instead of reading `getResolvedPath()`; the loop guard
throws `FileSymlinkLoopException(PathFragment)` (the 8.x constructor); the
symlink target of an unresolved symlink artifact is read from
`UnresolvedSymlinkArtifactValue#getSymlinkTarget` (8.x has no
`FileArtifactValue#getUnresolvedSymlinkTarget`); and the 8.x
`CacheNotFoundException` rewinding `onErrorResumeNext` is preserved.

On the repo side, 8.x has no `RepositoryUtils` or merged
`RepositoryFetchFunction`, so the `ReplantSymlinksResult` record and the
main-repo-symlink exclusion are applied to
`RepositoryFunction.replantSymlinks` and the `RepositoryDelegatorFunction`
caching path (where remote caching is now gated on `safeForRemoteCache()`
and local caching on `safeForLocalCache()`). `VendorManager` keeps its
existing private `replantSymlinks`, so the upstream call-signature change
there does not apply.

Depends on the replant prerequisite (bazelbuild#28582) backported in the preceding
slot.

Fixes bazelbuild#28575.
Fixes bazelbuild#29656.
Fixes bazelbuild#29515.

Closes bazelbuild#28683.

PiperOrigin-RevId: 893359962
Change-Id: If0eb64e41858a4b9298c2609d83160b0ecbfd451
(cherry picked from commit 90eb56e)

Closes bazelbuild#29767.

PiperOrigin-RevId: 936532134
Change-Id: I48b63f6fd2d5f57e139175e3ed578d65f6abbd08
(cherry picked from commit c310e3e)
fmeum added a commit to fmeum/bazel that referenced this pull request Jul 12, 2026
When using the remote repo contents cache, repo materialization now uses
the same code path as local action input prefetching for symlinks. This
ensures that each symlink is only materialized once and that there are no
races in case symlinking is not atomic (on Windows with default settings).
Along the way, remove unreachable code from `UploadManifest`.

Furthermore, when a remotely cached repo is partially materialized since it
contains action inputs, Skyframe provides the metadata of these inputs
after following all symlinks as it does for all source files. Since (chains
of) symlinks need to be preserved and materialized in the same way as if
the repo rule ran locally or was fully materialized as a dependency of
another repo rule, `AbstractActionInputPrefetcher` is changed to walk the
full chain of symlinks behind a prefetched external repo path and replant
every link verbatim on the host file system.

This proves very difficult to get right for repos with symlinks pointing
into the main repo as such symlinks would cross over into the host
filesystem. For this reason such symlinks now exclude a repo from being
cached remotely. Note that the local repo contents cache already doesn't
cache such repos. Since main repo files are readily available, this is
considered a minor loss in usefulness only.

This commit combines the backports of bazelbuild#28683 and bazelbuild#29767 into one: the
symlink-materialization tests added upstream in bazelbuild#28683 only pass on 8.x
once the chain-walk change from bazelbuild#29767 is in place, since repo files are
materialized lazily through `RemoteExternalOverlayFileSystem` rather than
fully on disk as on master.

8.x adaptation: `AbstractActionInputPrefetcher` on 8.x resolves input paths
via the Bazel 8.x-specific `resolveExecPath(execPath)` helper (which avoids
evaluating the WORKSPACE-named exec root when possible) and exposes the
exec root through the `execRoot()` method rather than an `execRoot` field,
so the new symlink handling is expressed in those terms. Because
`execRoot()` is not available during external repository materialization,
external repo paths are detected via a new `isUnderExternalRepoRoot`
helper (mirroring `DirectoryTracker.setWritable`) instead of
`!inputPath.startsWith(execRoot())`; both `getSymlinks` and `plantSymlink`
use it. The chain-walking is re-expressed on the exec-path-based symlink
model (`resolveExecPath`, `execRoot()`,
`FileArtifactValue#getMaterializationExecPath`) rather than the master
model (`getResolvedPath`, `execRoot` field): the `Symlink` record becomes
`(Path linkPath, PathFragment targetPath)` as upstream, but the
materialization case resolves `getMaterializationExecPath()` through
`resolveExecPath` instead of reading `getResolvedPath()`; the loop guard
throws `FileSymlinkLoopException(PathFragment)` (the 8.x constructor); the
symlink target of an unresolved symlink artifact is read from
`UnresolvedSymlinkArtifactValue#getSymlinkTarget` (8.x has no
`FileArtifactValue#getUnresolvedSymlinkTarget`); and the 8.x
`CacheNotFoundException` rewinding `onErrorResumeNext` is preserved.

On the repo side, 8.x has no `RepositoryUtils` or merged
`RepositoryFetchFunction`, so the `ReplantSymlinksResult` record and the
main-repo-symlink exclusion are applied to
`RepositoryFunction.replantSymlinks` and the `RepositoryDelegatorFunction`
caching path (where remote caching is now gated on `safeForRemoteCache()`
and local caching on `safeForLocalCache()`). `VendorManager` keeps its
existing private `replantSymlinks`, so the upstream call-signature change
there does not apply.

Depends on the replant prerequisite (bazelbuild#28582) backported in the preceding
slot.

Fixes bazelbuild#28575.
Fixes bazelbuild#29656.
Fixes bazelbuild#29515.

Closes bazelbuild#28683.

PiperOrigin-RevId: 893359962
Change-Id: If0eb64e41858a4b9298c2609d83160b0ecbfd451
(cherry picked from commit 90eb56e)

Closes bazelbuild#29767.

PiperOrigin-RevId: 936532134
Change-Id: I48b63f6fd2d5f57e139175e3ed578d65f6abbd08
(cherry picked from commit c310e3e)
fmeum added a commit to fmeum/bazel that referenced this pull request Jul 13, 2026
When using the remote repo contents cache, repo materialization now uses
the same code path as local action input prefetching for symlinks. This
ensures that each symlink is only materialized once and that there are no
races in case symlinking is not atomic (on Windows with default settings).
Along the way, remove unreachable code from `UploadManifest`.

Furthermore, when a remotely cached repo is partially materialized since it
contains action inputs, Skyframe provides the metadata of these inputs
after following all symlinks as it does for all source files. Since (chains
of) symlinks need to be preserved and materialized in the same way as if
the repo rule ran locally or was fully materialized as a dependency of
another repo rule, `AbstractActionInputPrefetcher` is changed to walk the
full chain of symlinks behind a prefetched external repo path and replant
every link verbatim on the host file system.

This proves very difficult to get right for repos with symlinks pointing
into the main repo as such symlinks would cross over into the host
filesystem. For this reason such symlinks now exclude a repo from being
cached remotely. Note that the local repo contents cache already doesn't
cache such repos. Since main repo files are readily available, this is
considered a minor loss in usefulness only.

This commit combines the backports of bazelbuild#28683 and bazelbuild#29767 into one: the
symlink-materialization tests added upstream in bazelbuild#28683 only pass on 8.x
once the chain-walk change from bazelbuild#29767 is in place, since repo files are
materialized lazily through `RemoteExternalOverlayFileSystem` rather than
fully on disk as on master.

8.x adaptation: `AbstractActionInputPrefetcher` on 8.x resolves input paths
via the Bazel 8.x-specific `resolveExecPath(execPath)` helper (which avoids
evaluating the WORKSPACE-named exec root when possible) and exposes the
exec root through the `execRoot()` method rather than an `execRoot` field,
so the new symlink handling is expressed in those terms. Because
`execRoot()` is not available during external repository materialization,
external repo paths are detected via a new `isUnderExternalRepoRoot`
helper (mirroring `DirectoryTracker.setWritable`) instead of
`!inputPath.startsWith(execRoot())`; both `getSymlinks` and `plantSymlink`
use it. The chain-walking is re-expressed on the exec-path-based symlink
model (`resolveExecPath`, `execRoot()`,
`FileArtifactValue#getMaterializationExecPath`) rather than the master
model (`getResolvedPath`, `execRoot` field): the `Symlink` record becomes
`(Path linkPath, PathFragment targetPath)` as upstream, but the
materialization case resolves `getMaterializationExecPath()` through
`resolveExecPath` instead of reading `getResolvedPath()`; the loop guard
throws `FileSymlinkLoopException(PathFragment)` (the 8.x constructor); the
symlink target of an unresolved symlink artifact is read from
`UnresolvedSymlinkArtifactValue#getSymlinkTarget` (8.x has no
`FileArtifactValue#getUnresolvedSymlinkTarget`); and the 8.x
`CacheNotFoundException` rewinding `onErrorResumeNext` is preserved.

On the repo side, 8.x has no `RepositoryUtils` or merged
`RepositoryFetchFunction`, so the `ReplantSymlinksResult` record and the
main-repo-symlink exclusion are applied to
`RepositoryFunction.replantSymlinks` and the `RepositoryDelegatorFunction`
caching path (where remote caching is now gated on `safeForRemoteCache()`
and local caching on `safeForLocalCache()`). `VendorManager` keeps its
existing private `replantSymlinks`, so the upstream call-signature change
there does not apply.

Depends on the replant prerequisite (bazelbuild#28582) backported in the preceding
slot.

Fixes bazelbuild#28575.
Fixes bazelbuild#29656.
Fixes bazelbuild#29515.

Closes bazelbuild#28683.

PiperOrigin-RevId: 893359962
Change-Id: If0eb64e41858a4b9298c2609d83160b0ecbfd451
(cherry picked from commit 90eb56e)

Closes bazelbuild#29767.

PiperOrigin-RevId: 936532134
Change-Id: I48b63f6fd2d5f57e139175e3ed578d65f6abbd08
(cherry picked from commit c310e3e)
fmeum added a commit to fmeum/bazel that referenced this pull request Jul 14, 2026
…ing (bazelbuild#30035)

When using the remote repo contents cache, repo materialization now uses
the same code path as local action input prefetching for symlinks. This
ensures that each symlink is only materialized once and that there are
no races in case symlinking is not atomic (on Windows with default
settings). Along the way, remove unreachable code from `UploadManifest`.

Furthermore, when a remotely cached repo is partially materialized since
it contains action inputs, Skyframe provides the metadata of these
inputs after following all symlinks as it does for all source files.
Since (chains of) symlinks need to be preserved and materialized in the
same way as if the repo rule ran locally or was fully materialized as a
dependency of another repo rule, `AbstractActionInputPrefetcher` is
changed to walk the full chain of symlinks behind a prefetched external
repo path and replant every link verbatim on the host file system.

This proves very difficult to get right for repos with symlinks pointing
into the main repo as such symlinks would cross over into the host
filesystem. For this reason such symlinks now exclude a repo from being
cached remotely. Note that the local repo contents cache already doesn't
cache such repos. Since main repo files are readily available, this is
considered a minor loss in usefulness only.

This PR combines the backports of bazelbuild#28683 and bazelbuild#29767 into a single
commit, subsuming bazelbuild#30028: the symlink-materialization tests added
upstream in bazelbuild#28683 only pass on 8.x once the chain-walk change from
bazelbuild#29767 is in place, since repo files are materialized lazily through
`RemoteExternalOverlayFileSystem` rather than fully on disk as on
master.

8.x adaptation: `AbstractActionInputPrefetcher` on 8.x resolves input
paths via the Bazel 8.x-specific `resolveExecPath(execPath)` helper
(which avoids evaluating the WORKSPACE-named exec root when possible)
and exposes the exec root through the `execRoot()` method rather than an
`execRoot` field, so the new symlink handling is expressed in those
terms. Because `execRoot()` is not available during external repository
materialization, external repo paths are detected via a new
`isUnderExternalRepoRoot` helper (mirroring
`DirectoryTracker.setWritable`) instead of
`!inputPath.startsWith(execRoot())`; both `getSymlinks` and
`plantSymlink` use it. The chain-walking is re-expressed on the
exec-path-based symlink model (`resolveExecPath`, `execRoot()`,
`FileArtifactValue#getMaterializationExecPath`) rather than the master
model (`getResolvedPath`, `execRoot` field): the `Symlink` record
becomes `(Path linkPath, PathFragment targetPath)` as upstream, but the
materialization case resolves `getMaterializationExecPath()` through
`resolveExecPath` instead of reading `getResolvedPath()`; the loop guard
throws `FileSymlinkLoopException(PathFragment)` (the 8.x constructor);
the symlink target of an unresolved symlink artifact is read from
`UnresolvedSymlinkArtifactValue#getSymlinkTarget` (8.x has no
`FileArtifactValue#getUnresolvedSymlinkTarget`); and the 8.x
`CacheNotFoundException` rewinding `onErrorResumeNext` is preserved.

On the repo side, 8.x has no `RepositoryUtils` or merged
`RepositoryFetchFunction`, so the `ReplantSymlinksResult` record and the
main-repo-symlink exclusion are applied to
`RepositoryFunction.replantSymlinks` and the
`RepositoryDelegatorFunction` caching path (where remote caching is now
gated on `safeForRemoteCache()` and local caching on
`safeForLocalCache()`). `VendorManager` keeps its existing private
`replantSymlinks`, so the upstream call-signature change there does not
apply.

Depends on the replant prerequisite (bazelbuild#28582) backported in bazelbuild#30034.

Fixes bazelbuild#28575.
Fixes bazelbuild#29656.
Fixes bazelbuild#29515.

Closes bazelbuild#28683.

PiperOrigin-RevId: 893359962
Change-Id: If0eb64e41858a4b9298c2609d83160b0ecbfd451
(cherry picked from commit 90eb56e)

Closes bazelbuild#29767.

PiperOrigin-RevId: 936532134
Change-Id: I48b63f6fd2d5f57e139175e3ed578d65f6abbd08
(cherry picked from commit c310e3e)
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. team-Remote-Exec Issues and PRs for the Execution (Remote) team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remote repo contents cache fails to materialize repo containing symlinks on Windows

3 participants