PG1204 opened a new pull request, #5146:
URL: https://github.com/apache/texera/pull/5146

   ### What changes were proposed in this PR?
   Fixes a visual regression where an operator's border, state text, port row 
counts, and worker count reset to default after navigating away from a workflow 
page and returning, even though the execution state is still cached in 
WorkflowStatusService.
   
   Root cause: WorkspaceComponent clears the workflow on destroy and calls 
reloadWorkflow() on re-init, recreating every operator from the workflow JSON 
with default JointJS attributes. The cached execution status was never 
reapplied, and the validation pass that runs on operator-add called 
changeOperatorColor(..., true) for valid operators, overwriting 
rect.body/stroke and forcing the border back to gray.
   
   Fix (two changes, both in workflow-editor.component.ts):
   
   Subscribe to getOperatorAddStream() inside handleOperatorStatisticsUpdate. 
When an operator is added (drag-drop, reloadWorkflow, undo/redo, collaborative 
add via Yjs - all routed through a single emission point), look up the cached 
OperatorStatistics. If present, call changeOperatorStatistics(...) to restore 
the state color, port labels, worker count, and state text. New operators with 
no cached entry early-return and get default coloring.
   
   Make handleOperatorValidation status-aware. Invalid operators still get a 
red border (priority preserved). For valid operators, the handler now checks 
the cached status - if one exists, it repaints via changeOperatorState(...) 
instead of overwriting with default gray. Valid operators with no cached status 
continue to get the default gray border.
   
   ### Any related issues, documentation, discussions?
   Fixes #3614.
   
   ### How was this PR tested?
   Unit tests: Three tests added to workflow-editor.component.spec.ts under a 
new describe("operator border restoration after navigation") block:
   
   Valid operator + cached Completed -> changeOperatorState(..., Completed) is 
called.
   Valid operator + empty cache -> default changeOperatorColor(..., true) is 
called (existing behavior preserved).
   Invalid operator + cached Completed -> changeOperatorColor(..., false) is 
called, red wins (existing behavior preserved).
   All three pass under Vitest (ng test).
   
   Manual UI testing: Reproduced the issue's recording locally:
   
   Open a workflow (e.g., CSV File Scan → Radar Chart) and run it; both 
operators turn green with port row counts.
   Navigate to a different page, then back.
   Before fix: operators reset to default gray borders, row counts blank. After 
fix: green borders, row counts, worker counts, and "Completed" state label all 
persist.
   Edge cases manually verified: fresh workflow (default coloring), new 
operator dragged in after a completed run (default for new, cached for 
existing), re-running (resetStatus repaints Uninitialized, live updates flow 
normally), invalid operator with cached Completed (red border, validation 
priority).
   
   ### Was this PR authored or co-authored using generative AI tooling?
   Co-authored-by: Claude Code (Anthropic Claude Opus 4.7)


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