Repository navigation
No-op: change written default scope from 'universal' to 'target' - #608
Merged
Merged
Conversation
…rget' But this is ignored in favor of --incompatible_exclude_starlark_flags_from_exec_config. see bazelbuild/bazel#26909
susinmotion
requested review from
brandjon,
c-mita,
comius,
hvadehra and
tetromino
as code owners
January 14, 2026 22:45
tetromino
approved these changes
Mar 24, 2026
Collaborator
Author
|
I don't think we honor the scope unless the rule specifies it directly. |
Collaborator
|
Aha, thanks, I missed the |
copybara-service Bot
pushed a commit
to bazelbuild/bazel
that referenced
this pull request
Jul 21, 2026
For example:
```py
_my_flag = rule(
...
attrs = {"scope": attr.string(default = "target")},
)
```
Bazel historically ignored this because Skylib flag rules [used to default](bazelbuild/bazel-skylib@390ecf8#diff-0d521430fd46dbc443c2f620b0ab8503a1226c3ef004f3b058ef1e870eab2e96L41) `"universal"` even though we wanted `--incompatible_exclude_starlark_flags_from_exec_config` to control scope defaults.
bazelbuild/bazel-skylib#608 gives Skylib flags a proper default. So now we don't have to worry about most flags propagating to exec configs even when `--incompatible_exclude_starlark_flags_from_exec_config` is enabled.
See #26909
PiperOrigin-RevId: 951611977
Change-Id: I45f66c4adc38f92ff608025ef08177191c6aa270
AleDema
pushed a commit
to AleDema/ic
that referenced
this pull request
Nov 18, 2026
Upgrades `bazel_skylib` from 1.9.0 to [1.9.2](https://github.com/bazelbuild/bazel-skylib/releases/tag/1.9.2), its latest release. 1.9.1 was tagged but its release CI failed, so it was never released or published to the BCR (see the [CHANGELOG](https://github.com/bazelbuild/bazel-skylib/blob/1.9.2/CHANGELOG.md)). The unstamped release artifacts are byte-identical to master. ## Changes - **`MODULE.bazel`**: version bump. BCR's `bazel_skylib/1.9.2` has no patches or overlays, and its `MODULE.bazel` declares the same dependencies as 1.9.0 (`platforms` 0.0.10, `rules_license` 1.0.0). Apart from skylib's own version, the full `bazel mod graph` is identical to master. - **`publish/canisters/BUILD.bazel`**: sets `allow_symlink = True` on its two `copy_file` calls, which copy the canister `.wasm.gz` files and their `.did` files. This keeps those copies as symlinks (see below). dfinity#12159 (rules_foreign_cc 0.17.0) also bumps `bazel_skylib` to 1.9.2, because rules_foreign_cc 0.17.0 requires it. It carries the same two `allow_symlink = True` lines, which are needed whichever of the two PRs lands first. ## Upstream changes that touch our setup Between the 1.9.0 and 1.9.2 release archives, only `copy_file`, `selects`, the `common_settings` rules and the version strings change. `write_file`, `run_binary`, `unittest`, `paths` and the rest of what we use are unchanged. - **`copy_file` copies by default again.** 1.9.0 made `allow_symlink` default to `True` for non-executable files ([bazelbuild/bazel-skylib#565](bazelbuild/bazel-skylib#565)). 1.9.2 reverts that default to `False` ([bazelbuild/bazel-skylib#605](bazelbuild/bazel-skylib#605), fixing [bazelbuild/bazel-skylib#604](bazelbuild/bazel-skylib#604)), so such a `copy_file` now runs `cp` instead of creating a symlink. - The `copy_file`s in `ic-os/defs.bzl` and `ic-os/setupos/defs.bzl` already set `allow_symlink = True`, so they don't change. - The two in `publish/canisters/BUILD.bazel` relied on the 1.9.0 default. dfinity#10679 removed the `.did` copies' `allow_symlink = False` so they would be symlinked, after dfinity#10672 made `ci/src/artifacts/upload.sh` upload symlinked bundle entries under their own names. With `allow_symlink = True` set explicitly, those 87 copies (44 `.wasm.gz`, 43 `.did`) stay symlinks; otherwise they would turn into `cp` actions. - Outside the release artifacts' graph, the revert turns 18 external `copy_file`s in the `//...` graph from symlinks into copies, because they use the default: rules_python's namespace-package `__init__.py` files for the numpy (11), pulp (4) and protobuf (2) wheels, and gawk's `config.h` (gawk comes in through rules_distroless). Their content doesn't change, and the tests that import those packages pass (see Verification). - **`selects.config_setting_group` with `//conditions:default`** now aliases a new `@bazel_skylib//lib:always_true` target instead of generating two `config_setting`s on `--stamp` ([bazelbuild/bazel-skylib#611](bazelbuild/bazel-skylib#611), [bazelbuild/bazel-skylib#629](bazelbuild/bazel-skylib#629)). We don't load `selects`, and no target in the configured `//...` graph depends on a `@bazel_skylib//lib` target. - **The `scope` attribute of the `common_settings` rules defaults to `"target"` instead of `"universal"`** ([bazelbuild/bazel-skylib#608](bazelbuild/bazel-skylib#608)). Our flags are defined with these rules (`//bazel:enable_fuzzing_code`, `//bazel:enable_malicious_code`, `//bazel:hermetic_cc`, `//:pocket-ic-server-variant`, ...), and none of them sets `scope`. - Bazel 9.3.2 only reads a flag's `scope` when it is set explicitly. That applies both to flags set on the command line ([`StarlarkOptionsParser`](https://github.com/bazelbuild/bazel/blob/9.3.2/src/main/java/com/google/devtools/build/lib/runtime/StarlarkOptionsParser.java#L256-L260)) and to flags set by transitions ([`BuildOptionsScopeFunction`](https://github.com/bazelbuild/bazel/blob/9.3.2/src/main/java/com/google/devtools/build/lib/skyframe/BuildOptionsScopeFunction.java#L181-L189)). - `--incompatible_exclude_starlark_flags_from_exec_config` is off by default in 9.3.2, and we don't set it. With it off, a flag without an explicit scope still propagates to the exec configuration ([`FunctionTransitionUtil`](https://github.com/bazelbuild/bazel/blob/9.3.2/src/main/java/com/google/devtools/build/lib/analysis/starlark/FunctionTransitionUtil.java#L239-L251)). - Checked with both versions: `--//bazel:enable_fuzzing_code=True` on the command line and `//bazel:enable_malicious_code` set by the `malicious_binary` transition both reach the exec configurations. The configuration hashes are the same as on master. ## Verification All in the dev container: - **Module graph:** `bazel mod graph` is identical to master apart from skylib's own version. `bazel mod explain bazel_skylib` shows every dependent resolving 1.9.2. There are no new warnings; the only one is the existing `rules_qemu` `use_repo()` warning. - **Analysis:** `bazel build //... --nobuild` analyzes all 3387 targets. - **Lint:** the CI Linter checks (`shfmt-check`, `ruff-check`, `buf-check`, `DFINITY-capitalization-check`, `do-not-merge-check`, `buildifier-check`, `gazelle-check`, `buf-breaking-check`) pass. `buildifier-fix`, `shfmt-fix`, `ruff-fix` and `gazelle` change nothing. - **`copy_file` actions:** in the release artifacts' graph there are 227 (215 symlinks, 12 copies). `bazel aquery` prints identical output for them with 1.9.0 and 1.9.2, action keys included. In the `//...` graph, the only differences are the 18 external symlink-to-copy switches listed above. - **Release artifacts are byte-identical to master** (133 files): the unstamped IC-OS bundles that `ci/container/build-ic.sh --icos` builds (GuestOS prod disk and update, GuestOS recovery update, HostOS update, SetupOS), `//publish/binaries:bundle` and `//publish/canisters:bundle`. No sandboxed actions ran: everything was a disk-cache hit apart from 26 uncacheable local actions. - **Tests:** these 33 pass: - `//bazel/mainnet_artifact_refs_tests:mainnet_artifact_refs_test`: 10 analysis tests built on skylib's `unittest`. - The 20 `file_size_check` tests in `//publish/canisters`, which read the symlinked canisters. - `//rs/recovery/subnet_splitting/split_finder:split_finder_test`, `//ci/githubstats:query_test` and `//ci/githubstats:query_help_test`. They import pandas (and with it numpy), pulp and protobuf, whose namespace `__init__.py` files are now copies. - **Builds:** - `//rs/rosetta-api/icp:version` and `//rs/rosetta-api/icrc1:version` (`write_file`) contain `2.1.10` and `1.2.10`. - `@@gawk+//:gawk` compiles with its `config.h` now a copied file. - **Not run locally:** the full build and test suite, the system tests and the macOS builds. CI covers those. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <[email protected]>
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.
But this is ignored in favor of --incompatible_exclude_starlark_flags_from_exec_config. see bazelbuild/bazel#26909