Description
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""whenvalidationResult.isValid, and otherwise builds an indented report: a"Workflow validation failed:"header, then oneOperator <id>:line per entry invalidationResult.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
forloop (173–178) rather than a single pass, so assert the ordering and indentation of all lines.
-
buildLogicalPlan(221–233) — theelsebranch, taken when noopsToViewResultsubset is supplied. It mapsworkflowState.getAllEnabledOperators()into operator entries (spreadingoperatorPropertiesand carryingoperatorID,operatorType,inputPorts,outputPorts) andworkflowState.getAllLinks()into links whosefromPortId/toPortIdcome fromgetOutputPortOrdinal/getInputPortOrdinalwithinternal: false. Cover it by callingbuildLogicalPlanwithopsToViewResultomitted, 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
getAllEnabledOperatorsis 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
- Testing / QA
- Documentation
- Performance
- Other
Activity
test(agent-service): cover the full logical-plan branch of buildLogic…
chore(agent-service): remove the unreferenced workflow validation for…