aglinxinyuan opened a new issue, #8148:
URL: https://github.com/apache/texera/issues/8148

   ### What happened?
   
   `WorkflowExecution.getState`'s `READY` arm is unreachable, so a workflow 
whose operators are all `READY` is reported as `RUNNING`.
   
   The chain is:
   
   1. `WorkflowExecution.getState` aggregates over 
`getAllOperatorExecutions.map(_._2.getState)` and ends with:
   
   ```scala
   } else if (runningOpStates.forall(_ == PAUSED)) {
     WorkflowAggregatedState.PAUSED
   } else if (runningOpStates.forall(_ == READY)) {   // <- unreachable
     WorkflowAggregatedState.READY
   } else {
     WorkflowAggregatedState.UNKNOWN
   }
   ```
   
   2. Each element of `runningOpStates` is an `OperatorExecution.getState`, 
which delegates to `ExecutionUtils.aggregateStates(workerStates, …, 
WorkerState.READY)`.
   
   3. `ExecutionUtils.aggregateStates` maps an all-ready set to **`RUNNING`**, 
not `READY`:
   
   ```scala
   } else if (unCompletedStates.forall(_ == readyState)) {
     WorkflowAggregatedState.RUNNING
   }
   ```
   
   So no `OperatorExecution` can ever return `READY`, and `WorkflowExecution`'s 
`forall(_ == READY)` test can never hold. The workflow-level `READY` state is 
effectively unusable.
   
   Expected: either an all-ready workflow reports `READY`, or the unreachable 
arm is removed and `WorkflowAggregatedState.READY` is documented as 
operator-level-only. Which of those is right is a product decision — the point 
of this report is that the current code says one thing and does another.
   
   Found while assessing test coverage. **Deliberately not pinned by a test**, 
because a test asserting the present behaviour would cement the unreachability 
and make the fix harder.
   
   ### How to reproduce?
   
   Static, no runtime repro needed:
   
   1. 
`amber/src/main/scala/org/apache/texera/amber/engine/architecture/coordinator/execution/WorkflowExecution.scala`
 — the `forall(_ == READY)` arm near the end of `getState`.
   2. 
`amber/src/main/scala/org/apache/texera/amber/engine/architecture/coordinator/execution/OperatorExecution.scala:73-84`
 — `getState` delegates to `aggregateStates`.
   3. 
`amber/src/main/scala/org/apache/texera/amber/engine/architecture/coordinator/execution/ExecutionUtils.scala:108-109`
 — the all-`readyState` case returns `RUNNING`.
   
   Coverage confirms it independently: the arm shows as never executed on 
`main`.
   
   ### Version/Branch
   
   1.3.0-incubating-SNAPSHOT (main)
   
   ### Was this issue authored using generative AI tooling?
   
   Generated-by: Claude Code (Opus 5)
   


-- 
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