Skip to content

Address review feedback on the bzlmod migration - #25

Merged
gartnera merged 2 commits into
masterfrom
fix-review-followups
Sep 9, 2026
Merged

gartnera merged 2 commits into
masterfrom
fix-review-followups

Conversation

@gartnera

@gartnera gartnera commented Sep 9, 2026

Copy link
Copy Markdown
Member

Four follow-ups from the review of #24:

Make the hermetic-sandbox guard actually execute something. The spawn strategy is not part of an action's key, so the hermetic build that followed a default-sandbox build of the same targets was a pure cache hit -- 0 spawns -- and could not have caught an under-declared toolchain input. Fork the configuration with --platform_suffix=hermetic so the actions have distinct keys. In a fresh output base, in CI order, the hermetic step goes from 0 spawns to 4.

Add a root .bazelignore for tests. Deleting tests/WORKSPACE removed the pruning that kept package loading out of the tests/ subtree, so bazel query/build/test '//...' at the repo root followed the bazel-tests convenience symlink into the output base and failed to load packages.

Fix the archive_override instructions. archive_override has no sha256 attribute, and integrity will not accept a hex sha256sum -- it needs the SRI spelling. Document how to produce it.

Make strip and objcopy work under the hermetic sandbox and remote execution. Unlike the ar/as wrappers, these never exported LD_LIBRARY_PATH, and Ubuntu's binutils need a libbfd that only exists inside the archives; the native toolchains additionally omitted host_libraries from strip_files/objcopy_files, so the library was not declared either. This was invisible because //:all never created a CcStrip action, so add a filegroup over the implicit .stripped outputs -- that pulls strip into every existing build step, plain and hermetic, in all three jobs.

Verified on Bazel 7.7.1 and 9.2.0 across all four configs (native, aarch64, jetpack_512, jetpack_62), plain and hermetic. objcopy is fixed by symmetry with strip but stays unexercised: no cc action in the test package invokes it.

Four follow-ups from the review of #24:

Make the hermetic-sandbox guard actually execute something. The spawn
strategy is not part of an action's key, so the hermetic build that
followed a default-sandbox build of the same targets was a pure cache
hit -- 0 spawns -- and could not have caught an under-declared toolchain
input. Fork the configuration with --platform_suffix=hermetic so the
actions have distinct keys. In a fresh output base, in CI order, the
hermetic step goes from 0 spawns to 4.

Add a root .bazelignore for tests. Deleting tests/WORKSPACE removed the
pruning that kept package loading out of the tests/ subtree, so
bazel query/build/test '//...' at the repo root followed the bazel-tests
convenience symlink into the output base and failed to load packages.

Fix the archive_override instructions. archive_override has no sha256
attribute, and integrity will not accept a hex sha256sum -- it needs the
SRI spelling. Document how to produce it.

Make strip and objcopy work under the hermetic sandbox and remote
execution. Unlike the ar/as wrappers, these never exported
LD_LIBRARY_PATH, and Ubuntu's binutils need a libbfd that only exists
inside the archives; the native toolchains additionally omitted
host_libraries from strip_files/objcopy_files, so the library was not
declared either. This was invisible because //:all never created a
CcStrip action, so add a filegroup over the implicit .stripped outputs
-- that pulls strip into every existing build step, plain and hermetic,
in all three jobs.

Verified on Bazel 7.7.1 and 9.2.0 across all four configs (native,
aarch64, jetpack_512, jetpack_62), plain and hermetic. objcopy is fixed
by symmetry with strip but stays unexercised: no cc action in the test
package invokes it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The verify step piped `bazel aquery --output=text` into `grep -qF` under
`set -o pipefail`. The compiler path first appears ~1.8KB from the end of a
~290KB dump, because the huge `Inputs:` line precedes the command line, so
grep matches and exits while bazel is still writing the tail. Bazel treats
the short stdout write as fatal -- "Cannot write to standard output;
exiting..." -- and exits 255, which pipefail then reports as a mis-selected
toolchain even though grep matched. Whether bazel's final flush beats grep's
exit is pure timing, so this failed only on a loaded runner and only for
whichever check lost the race.

Capture aquery to a file and grep that, which removes the pipe the race needs.
The same snippet was triplicated across the three jobs -- both native jobs
carried the identical bug and were only winning the race -- so it moves to
tests/verify_toolchain.sh alongside verify_binary.sh, taking config/expected
pairs. The captured output also serves the failure diagnostic, so a failing
check no longer re-runs aquery to report what it found.

Verified against the load that reproduced the failure 7/25 times: 0/25 with
the fix, on both Bazel 7.7.1 and 9.2.0.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@gartnera
gartnera merged commit 91734b5 into master Sep 9, 2026
7 checks passed
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