Skip to content

Conversation

@sluongng
Copy link
Contributor

TestRunner actions today can have child actions for distinct purposes:

a. If a test run does not generate the test.xml file, we will spin up a
new action to create this test.xml file.
b. We will also spin up new action to handle post coverage processing
when 'bazel coverage' is used.

It's hard to tell these 'child' actions apart from the parent
TestRunner action because they use the same action context, thus having
the same target label and mnemonic.
Give these child actions distinct mnemonics by cloning the parent's
TestRunnerAction with the mnemonic overrided.

Modify the 2 callsites for this code:

  1. CompactSpawnLogContext need to tell whether it's a TestRunner action
    to handle the runfiles accordingly. Ensure this includes the
    TestCoveragePostProcessing action and NOT the TestXmlGeneration
    action because the latter does not need these runfiles.

  2. SandboxStash can now detect these child actions based on the exact
    mnemonic instead of counting the outputs of TestRunner actions.

@sluongng sluongng requested a review from a team as a code owner December 29, 2025 11:08
@sluongng sluongng requested review from aranguyen and removed request for a team December 29, 2025 11:08
@sluongng
Copy link
Contributor Author

cc: @fmeum

@github-actions github-actions bot added team-Configurability platforms, toolchains, cquery, select(), config transitions team-Local-Exec Issues and PRs for the Execution (Local) team awaiting-review PR is awaiting review from an assigned reviewer labels Dec 29, 2025
@sluongng
Copy link
Contributor Author

Work towards #28076

Ideally, I would like to give these actions their own exec group as well. But that may require a longer conversation.

Copy link

@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 introduces distinct mnemonics for child actions spawned by TestRunnerAction, which improves the ability to identify and handle these actions specifically. The implementation is sound, using a subclass to override the mnemonic. My main feedback is to centralize the new mnemonic string constants, which are currently duplicated across four files, into the TestRunnerAction class to enhance maintainability.

Comment on lines 68 to 70
private static final String TEST_RUNNER_MNEMONIC = "TestRunner";
private static final String TEST_XML_GENERATION_MNEMONIC = "TestXmlGeneration";
private static final String TEST_COVERAGE_POST_PROCESSING_MNEMONIC = "TestCoveragePostProcessing";

Choose a reason for hiding this comment

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

high

To improve maintainability and prevent potential inconsistencies, these mnemonic constants, which are duplicated across several files (CompactSpawnLogContext, StandaloneTestStrategy, SandboxStash), should be centralized.

A good place for them would be the TestRunnerAction class, alongside the existing MNEMONIC constant.

For example, in TestRunnerAction.java:

public static final String MNEMONIC = "TestRunner";
public static final String XML_GENERATION_MNEMONIC = "TestXmlGeneration";
public static final String COVERAGE_POST_PROCESSING_MNEMONIC = "TestCoveragePostProcessing";

Then, other classes could reference these constants, e.g., TestRunnerAction.XML_GENERATION_MNEMONIC, which would make the code more robust and easier to maintain.

@sluongng sluongng force-pushed the sluongng/testrunner-mnemonic branch 2 times, most recently from 85a7b76 to 8689bc3 Compare December 29, 2025 15:20
TestRunner actions today can have child actions for distinct purposes:

a. If a test run does not generate the test.xml file, we will spin up a
new action to create this test.xml file.
b. We will also spin up new action to handle post coverage processing
when 'bazel coverage' is used.

It's hard to tell these 'child' actions apart from the parent
TestRunner action because they use the same action context, thus having
the same target label and mnemonic.
Give these child actions distinct mnemonics by cloning the parent's
TestRunnerAction with the mnemonic overrided.

Modify the 2 callsites for this code:

1. CompactSpawnLogContext need to tell whether it's a TestRunner action
   to handle the runfiles accordingly. Ensure this includes the
   TestCoveragePostProcessing action and NOT the TestXmlGeneration
   action because the latter does not need these runfiles.

2. SandboxStash can now detect these child actions based on the exact
   mnemonic instead of counting the outputs of TestRunner actions.
@sluongng sluongng force-pushed the sluongng/testrunner-mnemonic branch from 8689bc3 to c42ba24 Compare December 29, 2025 15:21
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-Configurability platforms, toolchains, cquery, select(), config transitions team-Local-Exec Issues and PRs for the Execution (Local) team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants