Skip to content

add unit test coverage for agent-service executeOperatorAndFormat (workflow-execution-tools.ts) #6374

Description

@mengw15

Task Summary

agent-service/src/agent/tools/workflow-execution-tools.ts (codecov ~7.5% — the service's single biggest gap, ~484 uncovered lines) has executeOperatorAndFormat(...): it validates a logical plan, runs it via executeWorkflowHttp, and formats the target operator's result. Unit-testable with bun test by mocking the HTTP call (executeWorkflowHttp / the execution-api module) to return canned SyncExecutionResults — no live backend; getBackendConfig and the workflow mutex can be stubbed.

Behavior to cover

  • empty logicalPlan.operators -> createErrorResult("Cannot execute: workflow has no operators.")
  • pre-exec validation fails with target-operator errors -> error listing them
  • executeWorkflowHttp returns result.success === false -> error with the returned error text
  • target operator info missing from the result -> error
  • target opInfo.error present -> error via formatExecutionError
  • opInfo.result missing / not an array -> "(no result data)"
  • result string exceeds the char limit -> truncated output
  • success path -> formatted operator result; options.onResult callback invoked when provided

Task Type

  • Refactor / Cleanup
  • DevOps / Deployment / CI
  • Testing / QA
  • Documentation
  • Performance
  • Other

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Fields

No fields configured for Task.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions