gnodet opened a new pull request, #14119:
URL: https://github.com/apache/maven/pull/14119

   ## Summary
   
   Fix a bug in the concurrent builder (`-b concurrent`) where `install` and 
`deploy` run
   even when a test fails. With `-DdeployAtEnd=true`, the whole reactor was 
deployed despite
   the build failure.
   
   ## Root Cause
   
   When a build step (e.g. `test`) fails, its matching `after:test` cleanup 
step runs for
   cleanup and is marked `SKIPPED` (not `FAILED`). The subsequent 
`after:unit-test` step
   then checked its direct predecessor (`after:test`) for `FAILED` status only. 
Since
   `after:test` is `SKIPPED`, the check returned false and `after:unit-test` 
ran normally
   as `EXECUTED`. From there, `after:verify` and then `install` and `deploy` 
saw only
   `EXECUTED` predecessors and ran as if nothing had gone wrong.
   
   The propagation chain:
   
   1. `test` fails → `FAILED`
   2. `after:test` runs for cleanup → `SKIPPED`
   3. `after:unit-test` checks predecessors: `after:test` is `SKIPPED`, not 
`FAILED` → runs normally → `EXECUTED` ← **bug**
   4. `after:verify` → `EXECUTED`
   5. `install`, `deploy` → `EXECUTED` ← should have been skipped
   
   ## Fix
   
   Extend the `anyPredecessorFailed` check in `processStep` to also treat 
`SKIPPED`
   predecessors as failure indicators for `after:*` steps. A `SKIPPED` 
`after:*` step
   signals that an upstream failure occurred; any later `after:*` step that 
sees it should
   itself run for cleanup only (marked `SKIPPED`), not execute normally.
   
   ```java
   // Before (only checked FAILED):
   boolean anyPredecessorFailed = step.predecessors.stream().anyMatch(s -> 
s.status.get() == FAILED);
   
   // After (also checks SKIPPED — cleanup steps that ran due to upstream 
failure):
   boolean anyPredecessorFailed = step.predecessors.stream()
           .anyMatch(s -> s.status.get() == FAILED || s.status.get() == 
SKIPPED);
   ```
   
   ## Tests
   
   Added `afterStepSkippedStatusPropagatesAcrossNestedPhases` to 
`BuildPlanExecutorTest`.
   The test pre-fails the `test` step in a `deploy`-phase plan and verifies 
that:
   - `after:test` is `SKIPPED` (ran for cleanup, as expected)
   - `install` is **not** `EXECUTED`
   - `deploy` is **not** `EXECUTED`
   - the project is recorded as `BuildFailure`
   
   The test fails on the unfixed code (`install` is `EXECUTED`, value=3) and 
passes on the fix.
   
   Fixes #14114
   
   ---
   _Hermes Agent (Claude Sonnet 4.5) on behalf of Guillaume Nodet_
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to