Skip to content

Hash external source directories backed by the workspace - #640

Open
tamird wants to merge 1 commit into
Tinder:masterfrom
tamird:codex/bazel-diff-workspace-directory-20261107
Open

tamird wants to merge 1 commit into
Tinder:masterfrom
tamird:codex/bazel-diff-workspace-directory-20261107

Conversation

@tamird

@tamird tamird commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Changing a file under a workspace directory exposed by an external repository can change a consuming genrule’s output while get-impacted-targets returns no targets. With --useCquery, the returned directory currently receives an empty source digest when its repository uses coarse hashing.

Hash that directory with the existing tree hasher when its canonical path is inside the workspace and disjoint from Bazel’s output base. Retain the repository dependency alongside the content digest. This extends #590’s returned regular file handling to this workspace directory case, using the existing nested symlink hashing semantics.

Validation:

  • Extend the stock Bazel 8.8.2 product fixture with independent regular file and directory child edits. Both changed products select their source and consumer, and the unrelated target stays excluded.
  • Unit coverage rejects a directory inside the output base and a workspace directory that contains it.
  • Canonical Rust and CLI tests, Clippy, formatting, and generated E2E checks pass.

Assisted by Codex.

Configured source labels can resolve to directories outside the fine repository set. The resolver accepted only regular files there, so editing a child left consumer hashes unchanged.

Use the existing tree hasher when the canonical directory root lies within the workspace and does not overlap the output base. Retain the repository fallback for inputs outside this content observation.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant