mengw15 opened a new issue, #7959:
URL: https://github.com/apache/texera/issues/7959
### Task Summary
`workflow-execution-tools.ts` is at **95.16 % with 21 uncovered lines**, and
they sit in exactly two places: a validation-error formatter that no test ever
calls, and the "all enabled operators" branch of `buildLogicalPlan`. Both are
pure functions over plain data — no network, no engine.
agent-service runs under **bun test**; extend
`workflow-execution-tools.spec.ts`.
### Behavior to add
**`workflow-execution-tools`**
(`agent-service/src/agent/tools/workflow-execution-tools.ts`, codecov 95.16 % —
EXTEND)
- **`formatWorkflowValidationErrors`** (169–178) — the entire function is
unreached. It returns `""` when `validationResult.isValid`, and otherwise
builds an indented report: a `"Workflow validation failed:"` header, then one `
Operator <id>:` line per entry in `validationResult.errors`, then one ` -
<field>: <message>` line per field error, joined with newlines. Cover:
- a valid result — returns the empty string;
- a result with one operator and one field error — assert the exact
three-line output;
- a result with **two operators, one of which has two field errors** —
this is what exercises the nested `for` loop (173–178) rather than a single
pass, so assert the ordering and indentation of all lines.
- **`buildLogicalPlan`** (221–233) — the `else` branch, taken when no
`opsToViewResult` subset is supplied. It maps
`workflowState.getAllEnabledOperators()` into operator entries (spreading
`operatorProperties` and carrying `operatorID`, `operatorType`, `inputPorts`,
`outputPorts`) and `workflowState.getAllLinks()` into links whose `fromPortId`
/ `toPortId` come from `getOutputPortOrdinal` / `getInputPortOrdinal` with
`internal: false`. Cover it by calling `buildLogicalPlan` with
`opsToViewResult` omitted, against a workflow state with at least two operators
and a link between them, and assert:
- every enabled operator appears, with its properties spread onto the
entry;
- each link resolves to the right port ordinals on both ends;
- a disabled operator is excluded (that is what `getAllEnabledOperators`
is for).
Keep the existing subset-path test so both arms of the branch stay covered.
Determinism notes:
- Build the workflow state from plain in-memory fixtures; do not reach a
backend or a live engine.
- Assert on the returned structure, not on JSON string equality of the whole
plan — field ordering is not part of the contract.
- Restore any spies at the end of each test so state does not leak between
cases.
### Task Type
- [ ] Refactor / Cleanup
- [ ] DevOps / Deployment / CI
- [x] Testing / QA
- [ ] Documentation
- [ ] Performance
- [ ] Other
--
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]