Skip to content

[ci] Patch gRPC BUILD files to disable layering_check#61623

Closed
andrew-anyscale wants to merge 1 commit intomasterfrom
andrew/revup/master/layering-check
Closed

[ci] Patch gRPC BUILD files to disable layering_check#61623
andrew-anyscale wants to merge 1 commit intomasterfrom
andrew/revup/master/layering-check

Conversation

@andrew-anyscale
Copy link
Copy Markdown
Contributor

clang-14's Bazel toolchain enables the layering_check feature, which generates per-rule .cppmap module-map files and enforces that headers are only included through declared BUILD dependencies. gRPC v1.57.1 explicitly opts into this feature via package(features = ["layering_check"]) in two BUILD files (BUILD and src/core/BUILD), but has undeclared cross-rule transitive header inclusions that pass with clang-12 but fail with clang-14.

With --spawn_strategy=local (used in test:ci), actions run unsandboxed and the compiler can access .cppmap files present in the output directory but not declared as inputs, producing "undeclared inclusion" errors across ~200 gRPC targets.

Rather than disabling layering_check globally, patch the two gRPC BUILD files to remove the explicit feature opt-in. This keeps layering_check active for Ray's own C++ code.

Topic: layering-check

Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com
Signed-off-by: andrew andrew@anyscale.com

@andrew-anyscale
Copy link
Copy Markdown
Contributor Author

Reviews in this chain:
#61623 [ci] Patch gRPC BUILD files to disable layering_check
 └#61533 [ci] upgrade CI test containers from Ubuntu 20.04 to 22.04

@andrew-anyscale
Copy link
Copy Markdown
Contributor Author

andrew-anyscale commented Mar 10, 2026

# head base diff date summary
0 a8a13fe3 55227f94 diff Mar 10 7:35 AM 2 files changed, 33 insertions(+)
1 aa6c579c d5391f90 diff Mar 10 9:57 AM 1 file changed, 4 insertions(+), 5 deletions(-)

@andrew-anyscale andrew-anyscale added the go add ONLY when ready to merge, run all tests label Mar 10, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request adds a patch to disable the layering_check feature in gRPC's BUILD files. This is a workaround for a Bazel bug that appears with clang-14. The change is well-motivated and the explanation in the code is excellent. I have one suggestion to make the patch file itself more minimal and consistent.

Comment on lines +19 to +21
- features = [
- "layering_check",
- ],
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.

medium

This part of the patch removes the entire features attribute from src/core/BUILD. For consistency with the patch for the root BUILD file (which only removes the layering_check entry), and to make the patch more minimal, consider changing this part of the patch to only remove the "layering_check" line. This would leave features = [] in the target file, which is valid and still achieves the goal. A more minimal and consistent patch is easier to maintain.

clang-14's Bazel toolchain enables the layering_check feature, which generates per-rule .cppmap module-map files and enforces that headers are only included through declared BUILD dependencies. gRPC v1.57.1 explicitly opts into this feature via package(features = ["layering_check"]) in two BUILD files (BUILD and src/core/BUILD), but has undeclared cross-rule transitive header inclusions that pass with clang-12 but fail with clang-14.

With --spawn_strategy=local (used in test:ci), actions run unsandboxed and the compiler can access .cppmap files present in the output directory but not declared as inputs, producing "undeclared inclusion" errors across ~200 gRPC targets.

Rather than disabling layering_check globally, patch the two gRPC BUILD files to remove the explicit feature opt-in. This keeps layering_check active for Ray's own C++ code.

Topic: layering-check

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: andrew <andrew@anyscale.com>
@andrew-anyscale andrew-anyscale force-pushed the andrew/revup/master/layering-check branch from a8a13fe to aa6c579 Compare March 10, 2026 16:57
@ray-gardener ray-gardener bot added core Issues that should be addressed in Ray Core devprod labels Mar 10, 2026
@rueian
Copy link
Copy Markdown
Contributor

rueian commented Mar 11, 2026

I am also doing a similar thing at #61499

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci core Issues that should be addressed in Ray Core devprod go add ONLY when ready to merge, run all tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants