Skip to content

Hash isolated repository inputs at their ordinary consumers - #592

Merged
tinder-maxwellelliott merged 2 commits into
Tinder:masterfrom
tamird:isolated-dependency-root
Oct 31, 2026
Merged

tinder-maxwellelliott merged 2 commits into
Tinder:masterfrom
tamird:isolated-dependency-root

Conversation

@tamird

@tamird tamird commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Changing one crate in an isolated Cargo workspace can mark unrelated Rust targets as impacted. bazel-diff makes the extension's owning module depend on every generated repository, so users of the Rust rules can look like consumers of the changed crate.

--isolatedDependencyRoot=@hub names a workspace whose outside consumers reach it through ordinary target inputs or BUILD loads. bazel-diff queries the hub's dependency and build-file closure, then attaches the whole generated workspace to each observed consumer. The direct-reader regression keeps the target whose output changes and drops an independent target that only uses a tool from the same module.

An explicit request requires one imported hub and validates the emitted module and repository inventory, including coexisting module versions. Unsupported query modes, ambiguous ownership, incomplete discovery, and known outside repository-file readers fail with the requested root and cause. Both serve and generate-hashes --partialGraph reject isolation before they can reuse a cached graph. Runs without the option retain ordinary behavior.

This remains an adopter assertion. A repository can compute a family path from an untyped string, watch or copy it, and supply an implicitly selected toolchain without exposing the read to bazel-diff. Run without this option for that workspace. 1

Prepared with Codex.

Bzlmod conservatively connects extensions' generated repositories to their
owning module. Changes to one isolated usage therefore reach other users
of its generator, even when their targets consume none of its outputs.

Add an opt-in for a root-isolated usage whose outside consumers are
represented in the ordinary query. Acquire its target and BUILD closure
and retain the whole usage at each observed reader. Fold member source
digests and the physical paths named by repository-rule label attributes
into its synthetic root. Keep owner dependencies for incomplete bindings
and known outside repository readers. Keep other usages unchanged.

Exercise shared BUILD loads, direct spoke consumers, repository-time
file reads and a distinct registered toolchain through the CLI. The raw
target API cannot retain the extra inputs and directs callers to the
integrated generation entry point.
The isolated-root option in 1d6b045 could return successful hashes
with ordinary owner dependencies retained, or remain inactive on
unsupported Bazel and cquery. Callers could not distinguish that
fallback from an applied scope.

Reject those requests before repository hashing and name the requested
root and known cause. Validate the emitted module inventory and include
coexisting hidden versions by their canonical repository names. Reject
serve before cache setup because its source mode cannot apply the
option.

Unflagged generation retains its existing behavior. The adopter must
still audit toolchains and repository reads that ordinary inputs do not
represent.
@tamird
tamird force-pushed the isolated-dependency-root branch from 968b00c to fd7c20f Compare October 31, 2026 14:34
@tinder-maxwellelliott
tinder-maxwellelliott merged commit 2f85abd into Tinder:master Oct 31, 2026
19 checks passed
@tamird
tamird deleted the isolated-dependency-root branch October 31, 2026 16:28
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.

2 participants