Draft
bazel/deps: Handle transitions in reachability aspect (re-land #5149)#5152
Conversation
✅ Deploy Preview for nifty-bassi-e26446 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Supersedes #5149. Resolves conflicts by: - Split transition carries both config-matrix flags and the two exclusion build settings (_excluded_edges, _excluded_patterns) so exec-cfg safety is preserved across all analyzed configurations. - consumers[].attrs is accumulated and emitted as a sorted union across configs, consistent with roots union semantics. New features (from #5149): - dependency_reachability_rule(flags, defines) constructor for split transitions - dependency_reachability_macro(impl) macro wrapper accepting configs dict - Multi-config JSON output with per-repo configs list and union merge semantics - _decode_configs, _encode_configs, config_validation_error, merge_defines helpers (config_validation_error and merge_defines exported for unit testing) Kept from main: - excluded_edges / excluded_patterns attrs on all rule forms - _allowlist_function_transition - consumers[].attrs in JSON output with union semantics across configs - BuildSettingInfo transport for exec-cfg safe exclusions Tests: - reachability_test_rules.bzl: test rule constructed with reachability_mode flag - reachability_config_validation_test.bzl: unit tests for config_validation_error - reachability_merge_defines_test.bzl: unit tests for merge_defines - reachability_test.sh: multi-config assertions including consumers[].attrs union - BUILD: new string_flag, config_setting, variant filegroups, multiconfig target Co-authored-by: phlax <454682+phlax@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Re-land change to handle transitions in reachability aspect
bazel/deps: Handle transitions in reachability aspect (re-land #5149)
Aug 24, 2026
This was referenced Aug 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Re-lands #5149 against current
main, resolving conflicts with two features that landed in the interim: exec-cfg-safe exclusion settings and per-edgeconsumers[].attrsrecording.Conflict resolution
Exclusion settings (
_excluded_edges/_excluded_patterns) are now carried through every branch of the split transition — the transitionoutputsinclude both the config-matrix flags and_EXCLUDED_EDGES_SETTING/_EXCLUDED_PATTERNS_SETTING. Only the flag settings appear ininputs(exclusions are written, never read from incoming settings). This preserves exec-configuration safety across all analyzed configs.consumers[].attrsis accumulated in_record_edgeas a dict and emitted as a sorted union — same semantics asroots. Correctly unioned across configs in the multiconfig case.New capability (from #5149)
Split-transition multiconfig analysis with a fixed-at-construction-time flag set:
Output gains a per-repo
configslist; all fields merge by union across configs (targets,configs,consumers[].roots,consumers[].attrs) with logical-OR for boolean fields (production,testonly).The existing
dependency_reachabilityis nowdependency_reachability_macro(_dependency_reachability_rule())— backward-compatible;excluded_edges/excluded_patterns/**kwargspass through unchanged.Exported helpers (for unit testing)
config_validation_error(configs, flags, defines)— validates config matrix against declared flagsmerge_defines(existing, values)— merges--defineassignmentsNew tests
reachability_config_validation_test.bzl/reachability_merge_defines_test.bzl— unit tests for the two exported helpersreachability_test_rules.bzl— constructs a test rule varying//dependency/test:reachability_modereachability_test.sh— multiconfig assertions includingconsumers[].attrsunion correctness