Repository navigation
go: keep internal Test Optimization helpers manual - #267
Merged
Merged
Conversation
There was a problem hiding this comment.
gnufede
approved these changes
Sep 22, 2026
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
dd_topt_go_testgenerates two implementation-only targets for every optimized Go test: the payload selector and the Bazel metadata writer. This change marks both helpersmanual, so recursive build and test patterns do not select them as independent top-level targets.The public Go test still depends on both helpers, so explicitly selected
.topttests keep the same payload selection, metadata generation, instrumentation, and upload behavior.Why
A consumer can declare static Test Optimization targets while keeping Test Optimization disabled for an ordinary Bazel invocation. Recursive target patterns should select the public tests, not their internal payload and metadata rules. Selecting an internal helper directly can force Bazel to analyze a disabled Test Optimization repository even though no optimized test was requested.
The strict repository-state validation remains unchanged when a helper or
.topttarget is selected explicitly.manualaffects wildcard build/test expansion; it does not hide targets fromqueryorcquery. Consumer-side declaration gating is therefore a separate follow-up where cquery must avoid disabled.topttargets entirely.Regression coverage
The new loading-phase suite inspects the rules generated by the real macro and verifies:
Validation
./bazelw test //modules/go/tests:go_macro_internal_helper_tags_tests --noexperimental_split_xml_generation --test_output=errors --noshow_progresscd modules/go && ../../bazelw test //... --override_module=datadog-rules-test-optimization=../.. --noexperimental_split_xml_generation --nocache_test_results --test_output=errors --noshow_progress(101 tests passed)./bazelw test //... --java_runtime_version=remotejdk_21 --tool_java_runtime_version=remotejdk_21 --noexperimental_split_xml_generation --test_env=PYTHON=/opt/homebrew/bin/python3.14 --test_output=errors --noshow_progress(511 tests passed)PYTHON=/opt/homebrew/bin/python3.14 USE_BAZEL_VERSION=8.5.1 tools/tests/integration/run_mock_server_tests.shtags = ["manual"]buildifier -mode=check modules/go/topt_go_test.bzl modules/go/tests/test_macro.bzl modules/go/tests/BUILD.bazelgit diff --check