Skip to content

[ML] Enforce zero warnings in debug Linux CI build - #3198

Merged
edsavage merged 3 commits into
elastic:mainfrom
edsavage:fix/werror-debug-linux-ci
Sep 21, 2026
Merged

edsavage merged 3 commits into
elastic:mainfrom
edsavage:fix/werror-debug-linux-ci

Conversation

@edsavage

@edsavage edsavage commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Adds -DCMAKE_COMPILE_WARNING_AS_ERROR=ON to the debug Linux x86_64 CI build step
  • PR [ML] Fix compiler warnings across the codebase #2985 reduced compiler warnings to zero on this configuration; this makes any regression an immediate build failure rather than silent accumulation
  • Scoped to the existing debug PR build step only, the release and cross-compile configurations are unchanged

Test plan

  • Verify the debug Linux build step still passes with zero warnings
  • Introduce a deliberate warning locally to confirm the build fails with a clear error

Add -DCMAKE_COMPILE_WARNING_AS_ERROR=ON to the debug Linux x86_64 CI
build step. PR elastic#2985 reduced compiler warnings to zero on this
configuration; this flag makes any regression an immediate build failure
rather than a silent accumulation.

The flag is scoped to the existing debug PR build step only, leaving
release and cross-compile configurations unchanged.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@elasticsearchmachine

Copy link
Copy Markdown

Pinging @elastic/ml-core (Team:ML)

@edsavage
edsavage force-pushed the fix/werror-debug-linux-ci branch from 884b942 to 1eab514 Compare September 17, 2026 03:28

Copilot AI left a comment

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.

🟢 Approval recommended

The remaining feedback is a non-blocking test-coverage nit.

Pull request overview

Enforces zero compiler warnings in the Linux x86_64 debug CI build.

Changes:

  • Enables CMAKE_COMPILE_WARNING_AS_ERROR=ON for the debug build.
  • Leaves release and cross-compile configurations unchanged.
File summaries
File Summary
.buildkite/pipelines/build_linux.json.py Adds warning-as-error enforcement; a non-blocking nit requests coverage verifying the flag remains scoped correctly.
Review details

Suppressed comments (1)

.buildkite/pipelines/build_linux.json.py:240

  • The existing pipeline-generator tests only assert that the debug step's label is present; they never inspect its environment. A later edit could remove this warning-as-error flag (or apply it to the wrong step) while all current tests still pass. Add coverage that finds the debug build step and asserts this flag is present, while the release/cross-compile steps remain unchanged.
              "CMAKE_FLAGS": "-DCMAKE_TOOLCHAIN_FILE=cmake/linux-x86_64.cmake -DML_FAST_DEBUG=ON -DCMAKE_UNITY_BUILD=ON -DML_PCH=ON -DCMAKE_COMPILE_WARNING_AS_ERROR=ON",
  • Files reviewed: 1/1 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@valeriy42
valeriy42 self-requested a review September 21, 2026 06:46
@edsavage
edsavage merged commit 045d226 into elastic:main Sep 21, 2026
24 checks passed
edsavage added a commit to edsavage/ml-cpp that referenced this pull request Sep 22, 2026
The top-level build applies ml-cpp's strict warning flags (including
-Wconversion) to every target via add_compile_options(${ML_CXX_FLAGS}),
and the debug Linux CI build enables CMAKE_COMPILE_WARNING_AS_ERROR=ON
(elastic#3198). Both leak into any vendored third-party sources compiled from
the 3rd_party subtree, whose own diagnostics we do not control, so a
warning there fails the whole build. Disable warnings-as-errors for that
subtree only, matching the existing save/restore pattern in the block.
ml-cpp's own targets are unaffected and still treat warnings as errors.

Co-authored-by: Cursor <cursoragent@cursor.com>
edsavage added a commit to edsavage/ml-cpp that referenced this pull request Sep 23, 2026
ml-cpp applies its strict warning flags (including -Wconversion) to every
target via add_compile_options(${ML_CXX_FLAGS}), and the debug Linux CI
build enables CMAKE_COMPILE_WARNING_AS_ERROR=ON (elastic#3198). This surfaces as
build failures in two distinct places once third-party dependencies are
actually compiled from the 3rd_party subtree:

  1. Compiling the third-party sources themselves, whose own warnings are
     promoted to errors.
  2. Compiling our own targets that include third-party headers, where the
     warnings originate in those headers (pulled in via -I, not -isystem).

Fix both without weakening linting of ml-cpp's own code:

  1. Disable warnings-as-errors for the third-party subtree only, matching
     the existing save/restore pattern in the block.
  2. Add the third-party include directories as SYSTEM so consuming targets
     compile those headers as system headers.

ml-cpp's own targets keep -Wconversion -Werror.

Co-authored-by: Cursor <cursoragent@cursor.com>
edsavage added a commit to edsavage/ml-cpp that referenced this pull request Sep 23, 2026
ml-cpp applies its strict warning flags (including -Wconversion) to every
target via add_compile_options(${ML_CXX_FLAGS}), and the debug Linux CI
build enables CMAKE_COMPILE_WARNING_AS_ERROR=ON (elastic#3198). Once third-party
dependencies are actually compiled from the 3rd_party subtree this breaks
the build in two places:

  1. Compiling the third-party sources themselves, whose own warnings are
     promoted to errors. Fixed by disabling warnings-as-errors for the
     third-party subtree only (matching the existing save/restore pattern),
     so their warnings stay visible but non-fatal.

  2. Compiling our own MlSandbox target, which includes Sandbox2/Abseil/
     protobuf headers. Those headers are pulled in as normal (-I) includes -
     deliberately not -isystem, so they stay ahead of PyTorch's bundled
     protobuf in the search path - and their value-changing conversions trip
     -Werror. Fixed by downgrading only the conversion diagnostics from
     errors to warnings for MlSandbox; all other warning classes stay fatal.

ml-cpp's own code keeps -Wconversion -Werror everywhere else.

Co-authored-by: Cursor <cursoragent@cursor.com>
edsavage added a commit to edsavage/ml-cpp that referenced this pull request Sep 23, 2026
ml-cpp applies its strict warning flags (including -Wconversion,
-Wunused-parameter, ...) to every target via
add_compile_options(${ML_CXX_FLAGS}), and the debug Linux CI build enables
CMAKE_COMPILE_WARNING_AS_ERROR=ON (elastic#3198). Once third-party dependencies are
actually compiled from the 3rd_party subtree this breaks the build in two
places:

  1. Compiling the third-party sources themselves, whose own warnings are
     promoted to errors. Fixed by disabling warnings-as-errors for the
     third-party subtree only (matching the existing save/restore pattern),
     so their warnings stay visible but non-fatal.

  2. Compiling our own targets that include Sandbox2/Abseil/protobuf headers
     (MlSandbox and its unit tests). Those headers are pulled in as normal
     (-I) includes - deliberately not -isystem, so they stay ahead of
     PyTorch's bundled protobuf in the search path - and are not warning-clean
     (conversion, unused-parameter, ...). Fixed by turning off
     warnings-as-errors on just those consuming targets, which is order-safe
     and covers every warning class the third-party headers may trip.

ml-cpp's own code keeps warnings-as-errors everywhere else.

Co-authored-by: Cursor <cursoragent@cursor.com>
valeriy42 pushed a commit that referenced this pull request Sep 23, 2026
ml-cpp applies its strict warning flags (including -Wconversion,
-Wunused-parameter, ...) to every target via
add_compile_options(${ML_CXX_FLAGS}), and the debug Linux CI build enables
CMAKE_COMPILE_WARNING_AS_ERROR=ON (#3198). Once third-party dependencies are
actually compiled from the 3rd_party subtree this breaks the build in two
places:

  1. Compiling the third-party sources themselves, whose own warnings are
     promoted to errors. Fixed by disabling warnings-as-errors for the
     third-party subtree only (matching the existing save/restore pattern),
     so their warnings stay visible but non-fatal.

  2. Compiling our own targets that include Sandbox2/Abseil/protobuf headers
     (MlSandbox and its unit tests). Those headers are pulled in as normal
     (-I) includes - deliberately not -isystem, so they stay ahead of
     PyTorch's bundled protobuf in the search path - and are not warning-clean
     (conversion, unused-parameter, ...). Fixed by turning off
     warnings-as-errors on just those consuming targets, which is order-safe
     and covers every warning class the third-party headers may trip.

ml-cpp's own code keeps warnings-as-errors everywhere else.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants