The GitHub Actions job "Backport Approval Check" on 
texera.git/gh-readonly-queue/main/pr-9594-8c8cdc86cf87445359c916bb7f0e7893aab0712e
 has succeeded.
Run started by GitHub user kunwp1 (triggered by kunwp1).

Head commit for run:
8f83565a1ab1f08192342f1378ff36db807c4399 / Kunwoo (Chris) 
<[email protected]>
fix(frontend): read the runtime stats fields the backend sends (#9594)

### What changes were proposed in this PR?

Problem. The runtime stats endpoint returns `dataProcessingTime`,
`controlProcessingTime`, `idleTime` and `numWorkers`, but the frontend
`WorkflowRuntimeStatistics` type reads `totalDataProcessingTime`,
`totalControlProcessingTime`, `totalIdleTime` and `numberOfWorkers`.
Every one of those values is `undefined`, so the three time tabs and the
Number of Workers tab in Runtime Statistics draw no lines, and the
heat-map restore gives each operator no processing time and one worker.

Fix. Renames the four fields in the frontend type, the Runtime
Statistics chart component and `runtime-statistics-mapper.ts` to the
names the backend sends. The backend names already match the Iceberg
runtime statistics schema, so the REST response does not change. It also
drops the type's `[key: string]: any` index signature, which let the
chart's metric keys name fields the type never declared, and types those
keys against the interface so the next mismatch fails to compile.

```
Before:  GET /stats -> { numWorkers: 32 } -> chart reads numberOfWorkers -> 
undefined -> empty chart
After:   GET /stats -> { numWorkers: 32 } -> chart reads numWorkers      -> 32
```

The Number of Workers tab for the same completed execution, before and
after:

| Before | After |
| --- | --- |
| <img width="563" height="500" alt="runtime-stats-before"
src="https://github.com/user-attachments/assets/2bbb010b-6409-47c5-a2f8-76e78d81f6b1";
/> | <img width="563" height="500" alt="runtime-stats-after"
src="https://github.com/user-attachments/assets/f7b8f688-5b62-429a-b67f-d3c02bcff58e";
/> |

Not included. The final stats snapshot of a run can race the writer
close in `ExecutionStatsService` (persist runs on its own thread, close
runs on the callback thread), which is a separate backend issue.

### Any related issues, documentation, discussions?

Closes #9590. Possibly related: #4152.

### How was this PR tested?

Two tests were added that parse the endpoint's JSON exactly as
`WorkflowExecutionsResource.WorkflowRuntimeStatistics` serializes it,
one for the chart datasets and one for the heat-map mapper, so a rename
on either side fails a test. The existing specs built rows with the
frontend names, which is why they missed this. With the old production
code and the new specs, both new tests fail along with 5 existing ones.

```
cd frontend && npx ng test --watch=false 
--include='**/workflow-runtime-statistics.component.spec.ts' 
--include='**/runtime-statistics-mapper.spec.ts' 
--include='**/heatmap-stats-restore.service.spec.ts'
cd frontend && npx ng test --watch=false
```

The first command passes 39 tests, including one that feeds the old
field names and checks the mapper ignores them. The second passes 6,875
tests; 9 unrelated spec files (formly, code editor, versions list) did
not load because `monaco-languageclient` cannot resolve a subpath on
Node 23.7, and they fail the same way without this change. `ngc -p
src/tsconfig.app.json --noEmit`, `ngc -p src/tsconfig.spec.json
--noEmit`, `prettier-eslint` and `eslint` ran clean on the changed
files.

Checked in a browser against a local stack on a completed execution with
1,730 stats rows: before the change every Number of Workers point is
`undefined` and the chart is empty; after it the chart shows 32 workers
for the Python UDF and 2 then 4 for the hash join, and Total Data
Processing Time plots up to about 16,000 s. The heat-map restore after a
page refresh was not clicked through and is covered by the mapper test
only.

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

Generated-by: Claude Code, Claude Opus 5.5

Report URL: https://github.com/apache/texera/actions/runs/45063492046

With regards,
GitHub Actions via GitBox

Reply via email to