Repository navigation
Conversation
`runfiles_rlocation_checked` looked up a path in the runfiles directory before consulting the manifest. Whether the runfiles directory is populated is a property of how the action or test is executed and is not known at analysis time, so the directory may exist while holding the stale contents of a previous execution. Consult the manifest first and only fall back to the runfiles directory if no manifest exists. This also fixes `runfiles_current_repository` on Windows with `--enable_runfiles`. That mode is the only one in which both `RUNFILES_DIR` and `RUNFILES_MANIFEST_FILE` are set: Windows does not sandbox, so the runfiles tree used at runtime contains the `MANIFEST` file that `runfiles_export_envvars` promotes to `RUNFILES_MANIFEST_FILE`. `rlocation` then returned a path inside the runfiles tree, but the manifest maps rlocation paths to the locations of the original files, so the caller could never be the target of a manifest entry and `runfiles_current_repository` reported every caller as belonging to the main repository. With the manifest taking precedence, callers are manifest targets again and the lookup succeeds. Note that runfiles that are empty files are recorded in the manifest with an empty target, so they no longer resolve when a manifest is present. This matches the existing behavior with `--noenable_runfiles`. `runfiles_current_repository` had no test coverage at all, which is why this went unnoticed. Cover all three combinations of the two envvars: directory only, manifest only, and both set at the same time. The last case also asserts that a stale copy in the runfiles directory is never preferred over the manifest.
Wyverald
approved these changes
Aug 12, 2026
This was referenced Aug 13, 2026
fmeum
added a commit
to fmeum/rules_shell
that referenced
this pull request
Aug 13, 2026
`runfiles_rlocation_checked` and `runfiles_current_repository` have to agree on where they look up runfiles: the output of the former is the input of the latter, and the manifest maps rlocation paths to the locations of the *original* files, so a path resolved against the runfiles directory is never the target of a manifest entry. bazel-contrib#68 made them agree on the manifest, at the cost of scanning it on every lookup and of returning paths outside the runfiles tree. Instead, have both use the runfiles directory whenever it has been materialized and the manifest otherwise, without ever falling back from one to the other. Whether the directory has been materialized is a property of how the action or test is executed rather than of the build: `--noenable_runfiles` leaves behind a directory that contains only the `MANIFEST` file and the subdirectory of the main repository, but the sandbox and remote execution materialize it in full regardless (they don't stage the manifest at all). The presence of this library in the directory distinguishes the two cases: it is an ordinary runfile, so it is materialized by exactly the mechanisms that also materialize every other runfile, and it is in the runfiles of every user of the library, which all load it via the initialization snippet that looks it up at this very path. The snippet therefore already made this determination when it sourced the library, and the library records it once on load, next to the other `_RLOCATION_` values it derives from the environment. `runfiles_export_envvars` in turn no longer passes on a runfiles directory it hasn't verified. It used to export any `RUNFILES_DIR` it could derive from the manifest path as long as that directory existed, which with `--noenable_runfiles` is the near-empty one, leaving a subprocess - which has to trust the value it is given - to resolve runfiles paths that don't exist. `runfiles_current_repository` now consistently returns 0 when it has to fall back to parsing the caller's execroot path; it used to do so only if the runfiles directory was used. Claude-Session: https://claude.ai/code/session_013o72rMrpgYKD9wYYQ2Nr98
fmeum
added a commit
to fmeum/rules_shell
that referenced
this pull request
Aug 13, 2026
`runfiles_rlocation_checked` and `runfiles_current_repository` have to agree on where they look up runfiles: the output of the former is the input of the latter, and the manifest maps rlocation paths to the locations of the *original* files, so a path resolved against the runfiles directory is never the target of a manifest entry. bazel-contrib#68 made them agree on the manifest, at the cost of scanning it on every lookup and of returning paths outside the runfiles tree. Instead, have both use the runfiles directory whenever it has been materialized and the manifest otherwise, without ever falling back from one to the other. Whether the directory has been materialized is a property of how the action or test is executed rather than of the build: `--noenable_runfiles` leaves behind a directory that contains only the `MANIFEST` file and the subdirectory of the main repository, but the sandbox and remote execution materialize it in full regardless (they don't stage the manifest at all). The presence of this library in the directory distinguishes the two cases: it is an ordinary runfile, so it is materialized by exactly the mechanisms that also materialize every other runfile, and it is in the runfiles of every user of the library, which all load it via the initialization snippet that looks it up at this very path. The snippet therefore already made this determination when it sourced the library, and the library records it once on load, next to the other `_RLOCATION_` values it derives from the environment. `runfiles_export_envvars` in turn no longer passes on a runfiles directory it hasn't verified. It used to export any `RUNFILES_DIR` it could derive from the manifest path as long as that directory existed, which with `--noenable_runfiles` is the near-empty one, leaving a subprocess - which has to trust the value it is given - to resolve runfiles paths that don't exist. `runfiles_current_repository` now consistently returns 0 when it has to fall back to parsing the caller's execroot path; it used to do so only if the runfiles directory was used. Claude-Session: https://claude.ai/code/session_013o72rMrpgYKD9wYYQ2Nr98
fmeum
added a commit
to fmeum/rules_shell
that referenced
this pull request
Aug 13, 2026
`runfiles_rlocation_checked` and `runfiles_current_repository` have to agree on where they look up runfiles: the output of the former is the input of the latter, and the manifest maps rlocation paths to the locations of the *original* files, so a path resolved against the runfiles directory is never the target of a manifest entry. bazel-contrib#68 made them agree on the manifest, at the cost of scanning it on every lookup and of returning paths outside the runfiles tree. Instead, have both use the runfiles directory whenever it has been materialized and the manifest otherwise, without ever falling back from one to the other. Whether the directory has been materialized is a property of how the action or test is executed rather than of the build: `--noenable_runfiles` leaves behind a directory that contains only the `MANIFEST` file and the subdirectory of the main repository, but the sandbox and remote execution materialize it in full regardless (they don't stage the manifest at all). The presence of this library in the directory distinguishes the two cases: it is an ordinary runfile, so it is materialized by exactly the mechanisms that also materialize every other runfile, and it is in the runfiles of every user of the library, which all load it via the initialization snippet that looks it up at this very path. The snippet therefore already made this determination when it sourced the library, so the library records it once on load rather than repeating it per lookup. `runfiles_export_envvars` in turn no longer passes on a runfiles directory it hasn't verified. It used to export any `RUNFILES_DIR` it could derive from the manifest path as long as that directory existed, which with `--noenable_runfiles` is the near-empty one, leaving a subprocess to resolve runfiles paths that don't exist. With both exported variables usable on their own, a subprocess needs no knowledge of which one this process picked, so that choice stays private to it. `runfiles_current_repository` now consistently returns 0 when it has to fall back to parsing the caller's execroot path; it used to do so only if the runfiles directory was used. Claude-Session: https://claude.ai/code/session_013o72rMrpgYKD9wYYQ2Nr98
fmeum
added a commit
to fmeum/rules_shell
that referenced
this pull request
Aug 13, 2026
`runfiles_rlocation_checked` and `runfiles_current_repository` have to agree on where they look up runfiles: the output of the former is the input of the latter, and the manifest maps rlocation paths to the locations of the *original* files, so a path resolved against the runfiles directory is never the target of a manifest entry. bazel-contrib#68 made them agree on the manifest, at the cost of scanning it on every lookup and of returning paths outside the runfiles tree. Instead, have both use the runfiles directory whenever it has been materialized and the manifest otherwise, without ever falling back from one to the other. Whether the directory has been materialized is a property of how the action or test is executed rather than of the build: `--noenable_runfiles` leaves behind a directory that contains only the `MANIFEST` file and the subdirectory of the main repository, but the sandbox and remote execution materialize it in full regardless (they don't stage the manifest at all). The presence of this library in the directory distinguishes the two cases: it is an ordinary runfile, so it is materialized by exactly the mechanisms that also materialize every other runfile, and it is in the runfiles of every user of the library, which all load it via the initialization snippet that looks it up at this very path. The snippet therefore already made this determination when it sourced the library, so the library records it once on load rather than repeating it per lookup. `runfiles_export_envvars` in turn no longer passes on a runfiles directory it hasn't verified. It used to export any `RUNFILES_DIR` it could derive from the manifest path as long as that directory existed, which with `--noenable_runfiles` is the near-empty one, leaving a subprocess to resolve runfiles paths that don't exist. With both exported variables usable on their own, a subprocess needs no knowledge of which one this process picked, so that choice stays private to it. `runfiles_current_repository` now consistently returns 0 when it has to fall back to parsing the caller's execroot path; it used to do so only if the runfiles directory was used. Claude-Session: https://claude.ai/code/session_013o72rMrpgYKD9wYYQ2Nr98
fmeum
added a commit
to fmeum/rules_shell
that referenced
this pull request
Aug 13, 2026
`runfiles_rlocation_checked` and `runfiles_current_repository` have to agree on where they look up runfiles: the output of the former is the input of the latter, and the manifest maps rlocation paths to the locations of the *original* files, so a path resolved against the runfiles directory is never the target of a manifest entry. bazel-contrib#68 made them agree on the manifest, at the cost of scanning it on every lookup and of returning paths outside the runfiles tree. Instead, have both use the runfiles directory whenever it has been materialized and the manifest otherwise, without ever falling back from one to the other. Whether the directory has been materialized is a property of how the action or test is executed rather than of the build: `--noenable_runfiles` leaves behind a directory that contains only the `MANIFEST` file and the subdirectory of the main repository, but the sandbox and remote execution materialize it in full regardless (they don't stage the manifest at all). The presence of this library in the directory distinguishes the two cases: it is an ordinary runfile, so it is materialized by exactly the mechanisms that also materialize every other runfile, and it is in the runfiles of every user of the library, which all load it via the initialization snippet that looks it up at this very path. The snippet therefore already made this determination when it sourced the library, so the library records it once on load rather than repeating it per lookup. `runfiles_export_envvars` in turn no longer passes on a runfiles directory it hasn't verified. It used to export any `RUNFILES_DIR` it could derive from the manifest path as long as that directory existed, which with `--noenable_runfiles` is the near-empty one, leaving a subprocess to resolve runfiles paths that don't exist. With both exported variables usable on their own, a subprocess needs no knowledge of which one this process picked, so that choice stays private to it. `runfiles_current_repository` now consistently returns 0 when it has to fall back to parsing the caller's execroot path; it used to do so only if the runfiles directory was used. Claude-Session: https://claude.ai/code/session_013o72rMrpgYKD9wYYQ2Nr98
fmeum
added a commit
to fmeum/rules_shell
that referenced
this pull request
Aug 13, 2026
`runfiles_rlocation_checked` and `runfiles_current_repository` have to agree on where they look up runfiles: the output of the former is the input of the latter, and the manifest maps rlocation paths to the locations of the *original* files, so a path resolved against the runfiles directory is never the target of a manifest entry. bazel-contrib#68 made them agree on the manifest, at the cost of scanning it on every lookup and of returning paths outside the runfiles tree. Instead, have both use the runfiles directory whenever it has been materialized and the manifest otherwise, without ever falling back from one to the other. Whether the directory has been materialized is a property of how the action or test is executed rather than of the build: `--noenable_runfiles` leaves behind a directory that contains only the `MANIFEST` file and the subdirectory of the main repository, but the sandbox and remote execution materialize it in full regardless (they don't stage the manifest at all). The presence of this library in the directory distinguishes the two cases: it is an ordinary runfile, so it is materialized by exactly the mechanisms that also materialize every other runfile, and it is in the runfiles of every user of the library, which all load it via the initialization snippet that looks it up at this very path. The snippet therefore already made this determination when it sourced the library, so the library records it once on load rather than repeating it per lookup. `runfiles_export_envvars` in turn no longer passes on a runfiles directory it hasn't verified. It used to export any `RUNFILES_DIR` it could derive from the manifest path as long as that directory existed, which with `--noenable_runfiles` is the near-empty one, leaving a subprocess to resolve runfiles paths that don't exist. With both exported variables usable on their own, a subprocess needs no knowledge of which one this process picked, so that choice stays private to it. `runfiles_current_repository` now consistently returns 0 when it has to fall back to parsing the caller's execroot path; it used to do so only if the runfiles directory was used. Claude-Session: https://claude.ai/code/session_013o72rMrpgYKD9wYYQ2Nr98
fmeum
added a commit
to fmeum/rules_shell
that referenced
this pull request
Aug 13, 2026
`runfiles_rlocation_checked` and `runfiles_current_repository` have to agree on where they look up runfiles: the output of the former is the input of the latter, and the manifest maps rlocation paths to the locations of the *original* files, so a path resolved against the runfiles directory is never the target of a manifest entry. bazel-contrib#68 made them agree on the manifest, at the cost of scanning it on every lookup and of returning paths outside the runfiles tree. Instead, have both use the runfiles directory whenever it has been materialized and the manifest otherwise, without ever falling back from one to the other. Whether the directory has been materialized is a property of how the action or test is executed rather than of the build: `--noenable_runfiles` leaves behind a directory that contains only the `MANIFEST` file and the subdirectory of the main repository, but the sandbox and remote execution materialize it in full regardless (they don't stage the manifest at all). The presence of this library in the directory distinguishes the two cases: it is an ordinary runfile, so it is materialized by exactly the mechanisms that also materialize every other runfile, and it is in the runfiles of every user of the library, which all load it via the initialization snippet that looks it up at this very path. The snippet therefore already made this determination when it sourced the library, so the library records it once on load rather than repeating it per lookup. `runfiles_export_envvars` in turn no longer passes on a runfiles directory it hasn't verified. It used to export any `RUNFILES_DIR` it could derive from the manifest path as long as that directory existed, which with `--noenable_runfiles` is the near-empty one, leaving a subprocess to resolve runfiles paths that don't exist. With both exported variables usable on their own, a subprocess needs no knowledge of which one this process picked, so that choice stays private to it. `runfiles_current_repository` now consistently returns 0 when it has to fall back to parsing the caller's execroot path; it used to do so only if the runfiles directory was used. Claude-Session: https://claude.ai/code/session_013o72rMrpgYKD9wYYQ2Nr98
fmeum
added a commit
to fmeum/rules_shell
that referenced
this pull request
Aug 13, 2026
`runfiles_rlocation_checked` and `runfiles_current_repository` have to agree on where they look up runfiles: the output of the former is the input of the latter, and the manifest maps rlocation paths to the locations of the *original* files, so a path resolved against the runfiles directory is never the target of a manifest entry. bazel-contrib#68 made them agree on the manifest, at the cost of scanning it on every lookup and of returning paths outside the runfiles tree. Instead, have both use the runfiles directory whenever it has been materialized and the manifest otherwise, without ever falling back from one to the other. Whether the directory has been materialized is a property of how the action or test is executed rather than of the build: `--noenable_runfiles` leaves behind a directory that contains only the `MANIFEST` file and the subdirectory of the main repository, but the sandbox and remote execution materialize it in full regardless (they don't stage the manifest at all). The presence of this library in the directory distinguishes the two cases: it is an ordinary runfile, so it is materialized by exactly the mechanisms that also materialize every other runfile, and it is in the runfiles of every user of the library, which all load it via the initialization snippet that looks it up at this very path. The snippet therefore already made this determination when it sourced the library, so the library records it once on load rather than repeating it per lookup. `runfiles_export_envvars` in turn no longer passes on a runfiles directory it hasn't verified. It used to export any `RUNFILES_DIR` it could derive from the manifest path as long as that directory existed, which with `--noenable_runfiles` is the near-empty one, leaving a subprocess to resolve runfiles paths that don't exist. With both exported variables usable on their own, a subprocess needs no knowledge of which one this process picked, so that choice stays private to it. `runfiles_current_repository` now consistently returns 0 when it has to fall back to parsing the caller's execroot path; it used to do so only if the runfiles directory was used. Claude-Session: https://claude.ai/code/session_013o72rMrpgYKD9wYYQ2Nr98
fmeum
added a commit
to fmeum/rules_shell
that referenced
this pull request
Aug 13, 2026
`runfiles_rlocation_checked` and `runfiles_current_repository` have to agree on where they look up runfiles: the output of the former is the input of the latter, and the manifest maps rlocation paths to the locations of the *original* files, so a path resolved against the runfiles directory is never the target of a manifest entry. bazel-contrib#68 made them agree on the manifest, at the cost of scanning it on every lookup and of returning paths outside the runfiles tree. Instead, have both use the runfiles directory whenever it has been materialized and the manifest otherwise, without ever falling back from one to the other. Whether the directory has been materialized is a property of how the action or test is executed rather than of the build: `--noenable_runfiles` leaves behind a directory that contains only the `MANIFEST` file and the subdirectory of the main repository, but the sandbox and remote execution materialize it in full regardless (they don't stage the manifest at all). The presence of this library in the directory distinguishes the two cases: it is an ordinary runfile, so it is materialized by exactly the mechanisms that also materialize every other runfile, and it is in the runfiles of every user of the library, which all load it via the initialization snippet that looks it up at this very path. The snippet therefore already made this determination when it sourced the library, so the library records it once on load rather than repeating it per lookup. `runfiles_export_envvars` in turn no longer passes on a runfiles directory it hasn't verified. It used to export any `RUNFILES_DIR` it could derive from the manifest path as long as that directory existed, which with `--noenable_runfiles` is the near-empty one, leaving a subprocess to resolve runfiles paths that don't exist. With both exported variables usable on their own, a subprocess needs no knowledge of which one this process picked, so that choice stays private to it. `runfiles_current_repository` now consistently returns 0 when it has to fall back to parsing the caller's execroot path; it used to do so only if the runfiles directory was used. Claude-Session: https://claude.ai/code/session_013o72rMrpgYKD9wYYQ2Nr98
fmeum
added a commit
to fmeum/rules_shell
that referenced
this pull request
Aug 13, 2026
`runfiles_rlocation_checked` and `runfiles_current_repository` have to agree on where they look up runfiles: the output of the former is the input of the latter, and the manifest maps rlocation paths to the locations of the *original* files, so a path resolved against the runfiles directory is never the target of a manifest entry. bazel-contrib#68 made them agree on the manifest, at the cost of scanning it on every lookup and of returning paths outside the runfiles tree. Instead, have both use the runfiles directory whenever it has been materialized and the manifest otherwise, without ever falling back from one to the other. Whether the directory has been materialized is a property of how the action or test is executed rather than of the build: `--noenable_runfiles` leaves behind a directory that contains only the `MANIFEST` file and the subdirectory of the main repository, but the sandbox and remote execution materialize it in full regardless (they don't stage the manifest at all). The presence of this library in the directory distinguishes the two cases: it is an ordinary runfile, so it is materialized by exactly the mechanisms that also materialize every other runfile, and it is in the runfiles of every user of the library, which all load it via the initialization snippet that looks it up at this very path. The snippet therefore already made this determination when it sourced the library, so the library records it once on load rather than repeating it per lookup. `runfiles_export_envvars` in turn no longer passes on a runfiles directory it hasn't verified. It used to export any `RUNFILES_DIR` it could derive from the manifest path as long as that directory existed, which with `--noenable_runfiles` is the near-empty one, leaving a subprocess to resolve runfiles paths that don't exist. With both exported variables usable on their own, a subprocess needs no knowledge of which one this process picked, so that choice stays private to it. `runfiles_current_repository` now consistently returns 0 when it has to fall back to parsing the caller's execroot path; it used to do so only if the runfiles directory was used.
AleDema
pushed a commit
to AleDema/ic
that referenced
this pull request
Nov 18, 2026
Upgrades `rules_shell` from 0.6.1 to [0.10.0](https://github.com/bazel-contrib/rules_shell/releases/tag/v0.10.0), its latest release. The only edit is the `bazel_dep` version in `MODULE.bazel`. How the repo uses rules_shell (`sh_binary` and `sh_test` loaded from `@rules_shell//shell:*.bzl`, with `srcs`, `data`, `env`, `env_inherit`, `args` and `exec_properties`) works unchanged. ## Changes - **`MODULE.bazel`**: version bump. BCR's `rules_shell/0.10.0` carries only the usual `module_dot_bazel_version.patch`. It requires the same `bazel_features` 1.18.0, `bazel_skylib` 1.6.1 and `platforms` 0.0.10 as 0.6.1, all below what we already resolve. So `rules_shell` is the only module whose resolved version changes: the full `bazel mod graph` before and after differs only in that line. The 12 other modules that depend on it (aspect_bazel_lib, bazel_lib, gazelle, llvm, protobuf, rules_apple, rules_distroless, rules_foreign_cc, rules_go, rules_jvm_external, rules_rust and rules_swift, per `bazel mod explain rules_shell`) now get 0.10.0 too. llvm 0.8.27 and rules_foreign_cc 0.17.0 both declare `bazel_dep(name = "rules_shell", version = "0.8.0")`, so the companion upgrades dfinity#12160 (llvm) and dfinity#12159 (rules_foreign_cc) carry this same one-line bump. Once one of these PRs is merged, the line is a no-op in the others. ## Upstream changes that touch our setup Since 0.6.1 there have been four releases: 0.7.0, 0.7.1, 0.8.0 and 0.10.0. 0.9.0 was tagged but never released or published to the BCR, and its changes ship in 0.10.0. These are the changes that matter here: - **`sh_binary` and `sh_test` need a launcher-maker toolchain and use automatic exec groups** ([bazel-contrib/rules_shell#79](bazel-contrib/rules_shell#79), 0.10.0). They now get the tool that builds Windows launchers from a mandatory `@bazel_tools//tools/launcher:launcher_maker_toolchain_type` toolchain. For our target platform `//:linux-glibc-2.31`, Bazel 9.3.2 resolves that type to `@bazel_tools//tools/launcher:3_no_launcher_maker_toolchain_impl` (`--toolchain_resolution_debug`; the Windows-only toolchain is rejected). So all `sh_*` targets still analyze. With automatic exec groups, the shell and launcher-maker toolchains each get their own exec group. The test action still runs in the `test` exec group, though, so the `test.cpu` exec property still applies to the test action only. `system_test` (`rs/tests/system_tests.bzl`) sets that property on `_local` system tests. aquery shows the same key and `ExecutionInfo` for the test actions of all `sh_test`s with 0.6.1 and with 0.10.0, e.g. `ExecutionInfo: {cpu: 19}` for `//rs/tests/boundary_nodes:api_bn_decentralization_test_head_nns_local`. - **`deps` of `sh_binary`/`sh_test` must provide `ShInfo`** instead of being an `sh_library` rule ([bazel-contrib/rules_shell#47](bazel-contrib/rules_shell#47), 0.7.0). None of our own `sh_*` targets set `deps`. In `//...` only `//:gazelle` and `//:gazelle-update-repos` do: the `gazelle` macro gives them `deps = ["@bazel_tools//tools/bash/runfiles"]`. In Bazel 9.3.2 that is an alias of `@rules_shell//shell/runfiles`, a rules_shell `sh_library`, which now provides `ShInfo`. - **The Bash runfiles library is reimplemented** ([dfinity#49](bazel-contrib/rules_shell#49), [dfinity#68](bazel-contrib/rules_shell#68), [dfinity#69](bazel-contrib/rules_shell#69), [dfinity#72](bazel-contrib/rules_shell#72)). `runfiles.bash` is now a wrapper that sources a new POSIX `runfiles.sh`, which is installed next to it and at `rules_shell/shell/runfiles/runfiles.sh`. `rlocation` now looks in the runfiles manifest before the runfiles directory, and manifest lookups use `awk` (honouring `$AWK`). The `use_bash_launcher` launcher switches to the v4 init snippet. None of our own scripts source the library, and no target sets `use_bash_launcher`. Two runners from other rulesets load it with the v3 init snippet and then call `rlocation`: - gazelle's runner (`//:gazelle`, `//:gazelle-update-repos`). It still works: `bazel run //:gazelle` and `//pre-commit:gazelle-check` both succeed. - the runner of rules_oci's `oci_load`, which also calls `runfiles_export_envvars`. The `oci_tar` macro (`rs/tests/system_tests.bzl`) creates 15 `oci_load` targets. We only use their `tarball` output group, which bsdtar writes at build time without the library, and nothing in the repo runs these runners. I ran the runner of `//rs/tests:minica_tarball` with a stub `docker` first on `PATH`. With 0.10.0 the library resolves the `tar` binary and the mtree spec through the runfiles manifest. `rlocation ""` for the unset `loader` attribute returns an empty string, so the runner falls back to `docker`, as it does with 0.6.1. With both versions bsdtar then can't find the image blobs. rules_oci 2.0.0's runner looks for the pulled image under `_main/external/`, but our runfiles trees put external repositories at the top level. That is unrelated to this upgrade. Every runfiles tree that contains the library now also contains `runfiles.sh`, at both paths. A cquery over `deps(//...)` finds the same 44 targets of ours with the library in their runfiles under 0.6.1 and 0.10.0: - the 2 gazelle runners; - the 15 `oci_load` targets and the 15 `*.tar` filegroups that wrap them; - the 12 variants of two system tests that list one of those filegroups in `runtime_deps`: `sr_nns_failover_nodes_test` (`STATIC_FILE_SERVER_IMAGE`) and `rosetta_neuron_follow_test` (`ROSETTA_IMAGE_PATH`). These system tests only pass the tarball's path to the test driver, and nothing in them sources the library. The remaining changes don't affect us: - Windows-only launcher changes. - `sh_toolchain.launcher_maker` is now a no-op. We don't define an `sh_toolchain`. - `@local_config_shell` now reports itself as non-reproducible ([dfinity#66](bazel-contrib/rules_shell#66)). - New public `ShInfo`/`ShBinaryInfo` providers, extra `exports_files`/`bzl_library` targets, and docs. ## Verification (dev container) - **Module graph:** `bazel mod graph` changes only for `rules_shell`. `bazel mod graph --depth=1` prints no new warnings; the existing `rules_qemu` `use_repo` warning is the only one. - **Analysis:** `bazel build //... --nobuild` analyzes all 3387 targets. - **Linter job parity:** the eight `//pre-commit` checks pass (shfmt, ruff, buf, DFINITY-capitalization, do-not-merge, buildifier, gazelle and buf-breaking). `buildifier-fix`, `shfmt-fix`, `ruff-fix` and `bazel run //:gazelle` leave the tree clean. Seven of the checks and three of the fixes run `sh_binary` targets. - **aquery, 0.6.1 vs 0.10.0, in the same output base:** I compared all 6543 actions of the 1335 `sh_binary` and `sh_test` targets that `kind("sh_test rule|sh_binary rule", //...)` returned. They include all 554 non-manual `sh_test`s and `//toolchains/sysimage:proc_wrapper`, the `sh_binary` that wraps every IC-OS build action, in both the target and the exec configuration. All actions run on `//:linux-glibc-2.31` with both versions. - The `TestRunner` and `ExecutableSymlink` actions all have identical keys and `ExecutionInfo`. - Runfiles manifests and trees change for 14 targets only: the two gazelle runners and the 12 system-test variants above, which gain `runfiles.sh`. - The `RepoMappingManifest` keys change for all targets, but what they write doesn't. A second aquery, with `--include_file_write_contents`, returned 660 `_repo_mapping` manifests, covering all 554 non-manual `sh_test`s, and their contents are identical. The built `.repo_mapping` files of `proc_wrapper` and `//ci/githubstats:query_help_test` are byte-identical. - **Builds:** 128 of the 138 `sh_binary` targets in `//...` build. I passed 128 of them to one `bazel build`, which built 126: the default `--build_tag_filters=-fuzz_test` drops the two AFL helpers `//bin/fuzzing:afl_wrapper` and `//bin/fuzzing:afl_clang_lto_linker` even when they are listed explicitly. I built those two separately with `--build_tag_filters=`, and `bazel build --nobuild --config=afl //rs/...` (the AFL fuzzers, which link with `afl_clang_lto_linker`) analyzes as well. I skipped the `vuln-scan` targets of the 7 other GuestOS environments and the `launch_bare_metal` targets of the 3 other SetupOS environments. They differ from the prod ones I built only in which image they take as data. - **Tests:** 58 `sh_test` targets pass with `--nocache_test_results`. That is every non-manual `sh_test` outside `//rs/tests` except the three image size checks of `//ic-os/guestos/envs/dev`. Together they cover each way we use `sh_test`: - `env` and `data` with `$(rootpath)`/`$(location)`: the canister and IC-OS image size checks, the endpoint checks, the canbench tests, `debug_assertion_test` and `query_help_test`; - `args`: `test_setupos`, `binary-libraries-test` and the canbench tests; - a Rust binary as `srcs`: the `rust_bench` smoke tests. - **Release artifacts:** byte-identical to a build of master (c712eb2). This covers the unstamped IC-OS bundles that `ci/container/build-ic.sh --icos` builds plus `//publish/binaries:bundle` and `//publish/canisters:bundle`: all 133 output files match. `proc_wrapper` is our only `sh_binary` in their build graph. - **Not run locally:** the system tests (493 non-manual `sh_test` targets under `//rs/tests`), the dev image size checks and anything on RBE. CI doesn't run all of these before merge either. On this PR and in the merge queue, CI builds and tests everything in `//...` except what `ci/scripts/targets.py` filters out by tag (`long_test`, `manual`, the Farm variants and a few more). That is 1070 tests, among them 111 `sh_test`s and 51 of the 493 system tests. The 324 system tests tagged `long_test` only run on master after merge, or on a PR with the `CI_ALL_BAZEL_TARGETS` label. They include the `_local` and `_head_nns_local` variants of the two system tests whose runfiles gain `runfiles.sh`. Their test actions are unchanged per the aquery comparison above. The fuzzer job's paths filter doesn't match `MODULE.bazel`, so its AFL and libFuzzer steps don't run on this PR. 🤖 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.
runfiles_rlocation_checkedlooked up a path in the runfiles directory before consulting the manifest. Whether the runfiles directory is populated is a property of how the action or test is executed and is not known at analysis time, so the directory may exist while holding the stale contents of a previous execution. Consult the manifest first and only fall back to the runfiles directory if no manifest exists.This also fixes
runfiles_current_repositoryon Windows with--enable_runfiles. That mode is the only one in which bothRUNFILES_DIRandRUNFILES_MANIFEST_FILEare set: Windows does not sandbox, so the runfiles tree used at runtime contains theMANIFESTfile thatrunfiles_export_envvarspromotes toRUNFILES_MANIFEST_FILE.rlocationthen returned a path inside the runfiles tree, but the manifest maps rlocation paths to the locations of the original files, so the caller could never be the target of a manifest entry andrunfiles_current_repositoryreported every caller as belonging to the main repository. With the manifest taking precedence, callers are manifest targets again and the lookup succeeds.runfiles_current_repositoryhad no test coverage at all, which is why this went unnoticed. Cover all three combinations of the two envvars: directory only, manifest only, and both set at the same time. The last case also asserts that a stale copy in the runfiles directory is never preferred over the manifest.Future work (bazelbuild/bazel#30674) will allow the directory to be used again in both functions, assuming it's materialized.