Add unit tests for hermetic_erlang_repository's OS/arch mapping#96
Merged
Conversation
This file's _ARCH mapping table has the exact same shape as gleam_host's (arm64/amd64 vs. aarch64/x86_64 spellings), and it's where the original macOS hermetic-Erlang arch bug was found earlier -- purely via a real CI failure on a real macOS runner, since no test existed for this file at all. Extracted the OS/arch/platform-constraint resolution out of _hermetic_erlang_repository_impl into a pure resolve_host(repository_ctx) function (same technique used for gleam_host's host_platform), and added test/unit/hermetic_erlang_repository covering every OS x arch combination (including both raw and erlef-normalized arch spellings) plus the two failure cases, so a repeat of that bug class fails fast locally instead of needing a real CI run to notice. No behavior change: resolve_host reproduces the exact same URL/checksum-key/constraint values the inlined per-branch logic did before.
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.
Summary
erlang/private/hermetic_erlang_repository.bzl's_ARCHmapping table has the exact same shape asgleam_host's (arm64/amd64vs.aarch64/x86_64spellings), and it's the file where the original macOS hermetic-Erlang arch bug was found earlier this session — purely via a real CI failure on a real macOS runner, since no test existed for this file at all._hermetic_erlang_repository_implinto a pureresolve_host(repository_ctx)function, using the same technique already used forgleam_host'shost_platform(a plain fake struct standing in for a realrepository_ctx, no Bazel machinery needed).test/unit/hermetic_erlang_repository/covering every OS x arch combination (including both the raw and erlef-normalized arch spellings on both Linux and macOS) plus the two failure cases (fail()on unsupported OS/arch), so a repeat of that bug class fails fast locally instead of needing a real CI run on the affected platform to notice.resolve_hostreproduces the exact same URL/checksum-key/constraint values the inlined per-branch logic did before.Test plan
buildifier -mode=diff/-lint=warnclean on all changed/added files (buildifier built locally viago installsince Bazel itself is unavailable in this environment)end-of-file-fixer,typos)bazel test //test/...(newhermetic_erlang_repository_test_suite)examples/hermetic_erlangbuild/test still passes on both Linux and macOS (proves the refactor didn't change runtime behavior)Generated by Claude Code