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

   ### What changes were proposed in this PR?
   
   Adds a unit test suite for `executeOperatorAndFormat` in
   `agent-service/src/agent/tools/workflow-execution-tools.ts`, which was
   previously uncovered. The function is the core of the agent's
   `executeOperator` tool: it builds a sub-DAG logical plan, validates the 
target
   operator, POSTs the execution request, and formats the result (or the 
failure)
   back to the model.
   
   The 13 tests cover every return branch:
   
   - **Guards & validation** — empty workflow (target absent); target operator's
     own connection-validation error blocks execution (no HTTP call made).
   - **Execution-level failures** — `Failed` (per-operator errors + `onResult`
     notification), `CompilationFailed` (compilation errors), `Killed` (timeout
     message), a rejected `fetch` (network error), and a non-ok HTTP response.
   - **Operator result handling** — success with no result entry for the target,
     an operator carrying an `error`, a non-tabular result placeholder, a
     well-formed tabular result (shape line + TSV rows + per-operator 
`onResult`),
     and char-limit truncation that keeps head/tail rows and drops the middle.
   - **Cancellation** — `AbortError` is re-thrown rather than formatted as a 
result.
   
   No production code was changed.
   
   ### Any related issues, documentation, discussions?
   
   Closes #6374
   
   ### How was this PR tested?
   
   New unit tests, run locally in `agent-service/` (all green, and the failure
   path was verified by deliberately breaking an assertion to confirm the suite
   goes red):
   
   ```
   bun test src/agent/tools/workflow-execution-tools.spec.ts
   # 13 pass, 0 fail, 38 expect() calls
   bun run typecheck       # tsc --noEmit, clean
   bun run format:check    # prettier, clean
   ```
   
   `fetch` and the `WorkflowSystemMetadata` singleton are stubbed, so the tests
   make no network calls and touch no live services.
   
   ### 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]

Reply via email to