Skip to content

fix(run): clarify sharded test errors with --script_path#29190

Open
abishekgiri wants to merge 1 commit intobazelbuild:masterfrom
abishekgiri:fix-16193-script-path-shard-error
Open

fix(run): clarify sharded test errors with --script_path#29190
abishekgiri wants to merge 1 commit intobazelbuild:masterfrom
abishekgiri:fix-16193-script-path-shard-error

Conversation

@abishekgiri
Copy link
Copy Markdown
Contributor

@abishekgiri abishekgiri commented Apr 2, 2026

Fixes #16193.

Summary

This change improves the clarity of the error message shown when running sharded tests with bazel run in --script_path mode.

Previously, the error message did not explicitly indicate that the limitation was specific to --script_path, which could make it unclear why sharded tests or --runs_per_test were rejected in this context.

This change:

updates the error message to explicitly mention --script_path when that mode is active
documents the sharding and --runs_per_test limitation in the corresponding flag help text
adds focused unit tests to verify the correct error message is selected

This is a user-facing clarity improvement only and does not change the underlying behavior of bazel run.

Testing
DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer bazel test
//src/test/java/com/google/devtools/build/lib/runtime:RunCommandTest
//src/test/java/com/google/devtools/build/lib/runtime:RunCommandLineTest

@github-actions github-actions Bot added team-Rules-Server Issues for serverside rules included with Bazel awaiting-review PR is awaiting review from an assigned reviewer labels Apr 2, 2026
@abishekgiri abishekgiri changed the title Clarify sharded test errors for run --script_path fix(run): clarify sharded test errors with --script_path Apr 2, 2026
@abishekgiri
Copy link
Copy Markdown
Contributor Author

This fixes #16193 by making the sharded-test error clearer when bazel run is used with --script_path.

Previously, the error did not clearly explain that the limitation was specific to --script_path mode, which made it harder to understand why sharded tests or --runs_per_test were rejected in that path.

This change:

  • updates the error message to explicitly mention --script_path when that mode is active
  • documents the sharding and --runs_per_test limitation in the relevant flag help text
  • adds focused unit coverage for the message-selection logic

This is a clarity/documentation fix only. It does not change the underlying behavior of bazel run; it only makes the failure mode easier to understand and discover.

@abishekgiri
Copy link
Copy Markdown
Contributor Author

Thanks — this PR does not change run behavior. It only makes the sharded-test failure clearer in --script_path mode, updates the flag help text to document the limitation, and adds unit coverage for the selected error message.

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

Labels

awaiting-review PR is awaiting review from an assigned reviewer team-Rules-Server Issues for serverside rules included with Bazel

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bazel run --script_path=test fails silently when target uses shard_count

1 participant