Skip to content

Change from stamp to some other boolean flag - #611

Merged
tetromino merged 6 commits into
bazelbuild:mainfrom
justinhorvitz:patch-1
Feb 5, 2026
Merged

tetromino merged 6 commits into
bazelbuild:mainfrom
justinhorvitz:patch-1

Conversation

@justinhorvitz

Copy link
Copy Markdown
Contributor

This removes a dependency on the value of --stamp, which we are using for internal caching.

@tetromino

Copy link
Copy Markdown
Collaborator

The stamp check was originally added by @gregestren in 6a6a509 - I'm wondering if there's a reason why it needed to be this way.

@justinhorvitz

Copy link
Copy Markdown
Contributor Author

The stamp check was originally added by @gregestren in 6a6a509 - I'm wondering if there's a reason why it needed to be this way.

Pretty sure that stamp is just the shortest boolean option. Maybe we should define a bool starlark flag instead, instead of choosing an arbitrary native flag?

Comment thread lib/selects.bzl Outdated
name_on = name + "_stamp_binary_on_check"
name_off = name + "_stamp_binary_off_check"
bool_name = name + "_bool"
bool_setting(

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you're touching this anyway, might make sense to make these Singleton targets instead of once per macro instantiation?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe, wasn't sure whether I should change the existing pattern of declaring the internal targets dynamically, so I kept it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I support the statically declared target for efficiency, although. Its probably not a big deal in practice, but it's a simple change.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@gregestren

Copy link
Copy Markdown
Contributor

Pretty sure that stamp is just the shortest boolean option. Maybe we should define a bool starlark flag instead, instead of choosing an arbitrary native flag?

Correct, and agreed on the Starlark flag conclusion.

Comment thread lib/BUILD Resolved

@tetromino tetromino left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wonder why CI was failing - unrelated pre-existing issue?

@tetromino
tetromino merged commit f7718b7 into bazelbuild:main Feb 5, 2026
1 check passed
@gregestren

Copy link
Copy Markdown
Contributor

Wonder why CI was failing - unrelated pre-existing issue?

Bug fixed by 4c9a8f5.

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]>
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.

4 participants