Skip to content

refactor(frontend): separate operator state and statistics in WorkflowStatusService - #8301

Open
PG1204 wants to merge 2 commits into
apache:mainfrom
PG1204:refactor/separate-state-and-statistics
Open

refactor(frontend): separate operator state and statistics in WorkflowStatusService#8301
PG1204 wants to merge 2 commits into
apache:mainfrom
PG1204:refactor/separate-state-and-statistics

Conversation

@PG1204

@PG1204 PG1204 commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

WorkflowStatusService currently bundles two different concepts in one object: OperatorStatistics carries both the operator's execution state (Running, Completed, …) and its statistics (row counts, sizes, timing). This PR splits them into separate sub-concepts, so the service now exposes three cleanly separated things: state, statistics, and performance metrics (the third was already separate, from #5834).

  • WorkflowStatusService now has a stream + snapshot pair per concept: getStateUpdateStream() / getCurrentState() for state, and getStatisticsUpdateStream() / getCurrentStatistics() for statistics (metrics only). The performance-metrics API is unchanged.
  • OperatorStatistics no longer contains operatorState. The combined shape the engine still sends over the websocket is typed as OperatorRuntimeStatus, and the service splits each update into the two maps. No backend or wire-format changes.
  • All consumers are migrated: components that only cared about state (result panel, code debugger, UDF debug service, property editor) now read the state stream; the workflow editor renders state (operator color) and statistics (port counts, worker count) from their own streams. JointUIService.changeOperatorStatistics renders statistics only — state rendering stays in changeOperatorState (its two long-unused isSource/isSink params are dropped along the way).
  • A small WorkflowGraph.getAllOperatorIDs() accessor keeps the per-update rendering path from materializing full operator predicates when only IDs are needed.

The change is behavior-preserving. One deliberate exception: the old code applied the "Recovering" display state by mutating the shared emitted map, which leaked masked states to other subscribers depending on subscription order. That accident is removed, and the override is now applied explicitly where state is rendered.

Rebased on top of the merged heat-map overlay (#6213), which consumes only the unchanged performance-metrics stream; its editor wiring is untouched by this refactor.

Any related issues, documentation, discussions?

Closes #5919. Part of umbrella #5772. Follow-up from the review discussion in #5834; follows RFC discussion #5216.

How was this PR tested?

The WorkflowStatusService spec now asserts state and statistics are exposed and update independently, and that statistics never leak operatorState. Consumer specs were updated to the new API, plus new tests for the state-rendering rules in the workflow editor (Uninitialized fallback, Recovering override, state label restored after navigation).

Full frontend suite passes (5,350 tests, 209 files); tsc --noEmit, eslint ./src, and Prettier are all clean.

Was this PR authored or co-authored using generative AI tooling?

This PR was co-authored using Claude in compliance with ASF.

@github-actions github-actions Bot added refactor Refactor the code frontend Changes related to the frontend GUI labels Aug 31, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Automated Reviewer Suggestions

Based on the git blame history of the changed files, we recommend the following reviewers:

  • Contributors with relevant context: @aglinxinyuan, @mengw15, @Yicong-Huang
    You can notify them by mentioning @aglinxinyuan, @mengw15, @Yicong-Huang in a comment.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.24561% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 94.09%. Comparing base (7d57cd6) to head (9a44593).

Files with missing lines Patch % Lines
...onent/workflow-editor/workflow-editor.component.ts 94.11% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #8301      +/-   ##
============================================
- Coverage     94.09%   94.09%   -0.01%     
  Complexity     4806     4806              
============================================
  Files          1193     1193              
  Lines         48493    48512      +19     
  Branches       5858     5860       +2     
============================================
+ Hits          45631    45646      +15     
- Misses         1420     1421       +1     
- Partials       1442     1445       +3     
Flag Coverage Δ *Carryforward flag
access-control-service 81.00% <ø> (ø) Carriedforward from 7d57cd6
agent-service 99.32% <ø> (ø) Carriedforward from 7d57cd6
amber 90.10% <ø> (ø) Carriedforward from 7d57cd6
computing-unit-managing-service 73.67% <ø> (ø) Carriedforward from 7d57cd6
config-service 87.00% <ø> (ø) Carriedforward from 7d57cd6
file-service 87.91% <ø> (ø) Carriedforward from 7d57cd6
frontend 96.86% <98.24%> (-0.02%) ⬇️
notebook-migration-service 79.31% <ø> (ø) Carriedforward from 7d57cd6
pyamber 98.18% <ø> (ø) Carriedforward from 7d57cd6
workflow-compiling-service 77.19% <ø> (ø) Carriedforward from 7d57cd6

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@PG1204

PG1204 commented Aug 31, 2026

Copy link
Copy Markdown
Contributor Author

/request-review @Yicong-Huang

@github-actions
github-actions Bot requested a review from Yicong-Huang August 31, 2026 22:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend Changes related to the frontend GUI refactor Refactor the code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Separate state and statistics as distinct sub-concepts in WorkflowStatusService

2 participants