Skip to content

bazel/hunspell: Fall back to source-built hunspell for consumers - #5563

Merged
phlax merged 6 commits into
envoyproxy:mainfrom
phlax:bazel-spelling
Nov 1, 2026
Merged

phlax merged 6 commits into
envoyproxy:mainfrom
phlax:bazel-spelling

Conversation

@phlax

@phlax phlax commented Nov 1, 2026

Copy link
Copy Markdown
Member

The prebuilt hub only covers Linux x86_64/aarch64, so on eg macOS consumers had no hunspell toolchain. Make the source build (@hunspell_src and @dictionary_en) and its toolchain non-dev, registered after the prebuilt hub: platforms without a prebuilt fetch and compile hunspell, everything else keeps the prebuilt.

Test the source build directly (resolution prefers the prebuilt), which also builds it for macOS in CI.

phlax and others added 2 commits November 1, 2026 16:40
The prebuilt hub only covers Linux x86_64/aarch64, so on eg macOS
consumers had no hunspell toolchain. Make the source build (`@hunspell_src`
and `@dictionary_en`) and its toolchain non-dev, registered after the
prebuilt hub: platforms without a prebuilt fetch and compile hunspell,
everything else keeps the prebuilt.

Test the source build directly (resolution prefers the prebuilt), which
also builds it for macOS in CI.

Signed-off-by: Ryan Northey <[email protected]>
The build overlay assumes POSIX headers, so register the source
toolchain per supported exec OS: elsewhere (eg Windows) resolution fails
cleanly instead of selecting a toolchain that cannot build.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Ryan Northey <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The new test fails on stock macOS because it uses mapfile, which is unavailable in system Bash 3.2, so it needs a compatible read loop or an explicitly provided newer Bash runtime.

1 open issue
What changed in this PR

This PR makes source-built hunspell available to downstream consumers when no prebuilt toolchain matches, notably on macOS, while preserving prebuilt preference.

Changes:

  • Exposes source archives and registers Linux/macOS source fallback toolchains for consumers.
  • Adds a direct source-build test and normalizes dictionary paths in the shared checker.
  • Updates documentation to explain fallback behavior.
File Description
bazel/​MODULE.bazel Makes source dependencies and fallback toolchains available to consumers.
bazel/​hunspell/​test/​BUILD Adds a direct test of source-built hunspell.
bazel/​hunspell/​test/​assert_hunspell_pipe.sh Accepts dictionary paths with or without .dic.
bazel/​hunspell/​source/​BUILD Constrains source toolchains to Linux and macOS execution platforms.
bazel/​hunspell/​README.md Documents consumer source fallback behavior.

Review effort: Balanced

Comment thread bazel/hunspell/test/BUILD Resolved
The source test now also runs on macOS, whose system bash 3.2 has no
`mapfile`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Ryan Northey <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

macOS CI does not exercise the new fallback toolchain registration or its provider/runfiles wiring because the existing toolchain test remains Linux-only.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Medium severity Run the toolchain test on macOS to cover source_toolchain_macos

bazel/​hunspell/​test/​BUILD:60

This checks the source executable but never resolves the fallback toolchain. The existing hunspell_toolchain_test is still Linux-only, so macOS CI does not exercise the new source_toolchain_macos registration or its provider/runfiles wiring. Remove that test's Linux-only constraint at line 15 so it also runs on macOS, while retaining this direct test for source-build coverage on Linux.

1 resolved since last review

Review effort: Balanced

Let `hunspell_toolchain_test` run on macOS, where it resolves the source
fallback, and run it with the direct source test in a macOS CI job: the
existing macOS job only builds, so nothing resolved and ran the fallback
there.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Ryan Northey <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

The test in bazel/hunspell/test/BUILD lacks Linux/macOS compatibility constraints, so its direct source dependency bypasses toolchain safeguards and attempts to compile POSIX-only code on Windows.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Medium severity Restrict the source overlay test to Linux and macOS

bazel/​hunspell/​test/​BUILD:71

This test bypasses toolchain resolution and unconditionally builds the source overlay, so bazel test //hunspell/test/... on Windows now attempts to compile code that requires POSIX headers such as unistd.h. The OS constraints on the fallback toolchains do not protect this direct dependency. Give this test the same Linux/macOS target_compatible_with select as hunspell_toolchain_test; it will still run in macOS CI while being skipped on unsupported platforms.

Review effort: Balanced

`hunspell_source_test` and `source_impl` build the source overlay
directly, outside the fallback toolchains' OS constraints, so on eg
Windows `//...` would try to compile POSIX-only code. Give them the same
Linux/macOS compatibility, and document the limit.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Ryan Northey <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The implementation’s OS constraint checks the target platform rather than the execution platform, making valid cross-platform toolchain resolutions incompatible despite hunspell and its dictionary being exec-configured dependencies.

1 open issue

Review effort: Balanced

Comment thread bazel/hunspell/source/BUILD Resolved
…entation

`target_compatible_with` on `source_impl` checked the consumer's target
platform, so a toolchain resolved for a supported exec platform could
still be rejected. Constrain the source `hunspell` binary instead: the
toolchain builds it in the exec configuration, so the check is against
the exec platform, and dependents (incl. the direct source test) are
skipped elsewhere.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Ryan Northey <[email protected]>
@phlax
phlax merged commit f08a971 into envoyproxy:main Nov 1, 2026
359 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