mengw15 opened a new pull request, #7159:
URL: https://github.com/apache/texera/pull/7159
### What changes were proposed in this PR?
Extends the existing `WorkflowState` spec to cover the remaining pure,
in-memory methods (`agent-service/src/agent/workflow-state.ts`). All are
deterministic; no external services are mocked. No production code was
changed.
16 tests, grouped by area:
- **`toLogicalPlan`** — the produced operators, port-indexed links (indices
resolved from each operator's port list), and the empty reuse list.
- **Traversal** — `getFrontierOperators(depth)` returning the leaf set and
expanding one hop upstream per depth (topologically ordered), and
`getSubDAG`
collecting a target's upstream operators and links.
- **Validation state** — `setValidationError` / `clearValidationError` /
`setAllValidationErrors` / `getValidationOutput`, the `workflowEmpty` flag
(no operators, or all disabled), and `getValidationChangedStream` emitting
on
each mutation.
- **`updateOperatorInputPorts`** — rebuilding the input-port list to a
requested
count (extras flagged dynamic), reducing the count, and the
missing-operator
guard.
- **Content round-trip** — `setWorkflowContent` replacing the state and
`getWorkflowContent` reflecting it, plus the default-settings fallback.
Two behaviours are asserted as the code actually behaves rather than as the
issue
describes them (both commented in the spec so a future change is caught):
- `toLogicalPlan(targetOperatorId?)` accepts a `targetOperatorId` argument
but the
current implementation **ignores it** — the whole-graph plan is produced
either
way. The test asserts `toLogicalPlan("op1")` equals `toLogicalPlan()`.
- `updateOperatorInputPorts` rebuilds the port list but does **not** prune
links
pointing at removed ports; the test asserts the link is left in place.
### Any related issues, documentation, discussions?
Closes #7158
### How was this PR tested?
Extended unit tests, run locally in `agent-service/` (all green; the failure
path
was verified by breaking an assertion to confirm the suite goes red):
```
bun test src/agent/workflow-state.spec.ts # 29 pass, 0 fail
bun run typecheck # tsc --noEmit, clean
prettier --check src/agent/workflow-state.spec.ts # clean
```
### Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Opus 4.8 [1M context])
--
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]