Skip to content

Track emulated symlinked directories recursively#29221

Open
abishekgiri wants to merge 2 commits intobazelbuild:masterfrom
abishekgiri:windows-symlink-invalidation-fix
Open

Track emulated symlinked directories recursively#29221
abishekgiri wants to merge 2 commits intobazelbuild:masterfrom
abishekgiri:windows-symlink-invalidation-fix

Conversation

@abishekgiri
Copy link
Copy Markdown
Contributor

@abishekgiri abishekgiri commented Apr 2, 2026

Description

This PR updates repository_ctx.symlink() invalidation tracking for emulated symlinks that target directories.

When Bazel cannot create a native symlink and falls back to copy-like behavior, directory targets now record a recursive DirTree input instead of a shallow File input. File targets keep the existing shallow watch behavior.

This change also adds unit coverage for emulated file and directory symlinks in StarlarkRepositoryContextTest.

Motivation

Directory-backed emulated symlinks were not tracked deeply enough for repository invalidation.

The fallback path always recorded a File input, which only captures that the directory exists. That is not sufficient to detect files being added, removed, or modified under the directory tree. Recording a recursive DirTree input fixes that behavior and adds regression coverage for it.

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

@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 Apr 2, 2026
@abishekgiri abishekgiri marked this pull request as draft April 2, 2026 23:48
@abishekgiri
Copy link
Copy Markdown
Contributor Author

Updated the invalidation tracking so emulated symlinks to directories now record recursive inputs, while emulated file symlinks keep the existing shallow file watch. Added focused unit coverage for both cases. Local Bazel validation on this machine is still blocked by the Xcode license gate from apple_support.

@bharadwaj08-one
Copy link
Copy Markdown

@abishekgiri Could you please take a look at the failing checks?

@bharadwaj08-one bharadwaj08-one added awaiting-user-response Awaiting a response from the author and removed awaiting-review PR is awaiting review from an assigned reviewer labels Apr 3, 2026
@abishekgiri
Copy link
Copy Markdown
Contributor Author

@abishekgiri Could you please take a look at the failing checks?

I traced the failing presubmits from Buildkite build #32714 to one shared strict-deps issue in StarlarkRepositoryContextTest, not 15 unrelated failures.

The new test path references DirectoryTreeDigestValue, but StarlarkTests_lib was missing the direct dep on //src/main/java/com/google/devtools/build/lib/skyframe:directory_tree_digest_value. I pushed 6c4be441b0 to add that missing dep in src/test/java/com/google/devtools/build/lib/bazel/repository/starlark/BUILD.

A targeted local bazel test //src/test/java/com/google/devtools/build/lib/bazel/repository/starlark:StarlarkTests --test_filter='.*EmulatedSymlink.*' --test_output=errors no longer surfaces the strict-deps error. The remaining local blocker here is the machine-wide Xcode license issue (xcrun code 69), so I’m waiting on the fresh Buildkite rerun to confirm CI.

@bharadwaj08-one bharadwaj08-one added awaiting-review PR is awaiting review from an assigned reviewer and removed awaiting-user-response Awaiting a response from the author labels Apr 7, 2026
@meteorcloudy meteorcloudy requested a review from Wyverald April 8, 2026 15:20
@meteorcloudy
Copy link
Copy Markdown
Member

Please update PR description according to our PR template

@abishekgiri
Copy link
Copy Markdown
Contributor Author

abishekgiri commented Apr 15, 2026

@meteorcloudy Updated the PR description to follow Bazel’s template. Thanks!

also http_file: add root BUILD to improve error when referencing repo root
#29136 got closed even after you approved it without any explanation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting-review PR is awaiting review from an assigned reviewer team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants