mengw15 opened a new issue, #6375:
URL: https://github.com/apache/texera/issues/6375

   ### Task Summary
   
   `agent-service/src/agent/tools/workflow-crud-tools.ts` (codecov ~22%) 
exports `createAddOperatorTool`, `createModifyOperatorTool`, 
`createDeleteOperatorTool` — factories returning AI-SDK tools whose 
`execute(args)` mutate an in-memory `WorkflowState`. Unit-testable with `bun 
test`: construct a real `WorkflowState`, build the tool, call 
`tool.execute(args)`, assert the state change + returned result. Only mock is 
`context.metadataStore.validateOperatorProperties` for the validation branches 
— no network. See `tools/tools-utility.spec.ts` for the pattern.
   
   ### Behavior to cover
   
   **createDeleteOperatorTool**
   - operator exists -> removes it (and connected links); returns `"Deleted 
operator: {operatorId}"`
   - operator absent -> `createErrorResult("Operator {operatorId} not found")`
   
   **createAddOperatorTool**
   - unknown `operatorType` (no schema entry) -> error
   - `operatorId` not matching `/^op\d+$/` -> error
   - `operatorId` already present -> error (`"... already exists. Use 
modifyOperator ..."`)
   - `properties` failing validation -> error carrying the validation messages
   - `inputOperatorIds` referencing a missing source operator -> error 
(`"Source operator ... not found"`)
   - target port index `NaN` / negative / `>= inputPorts.length` -> error
   - valid args -> adds operator + creates links; returns success
   
   **createModifyOperatorTool**
   - operator not found -> `createErrorResult("Operator {operatorId} not found 
...")`
   - merged properties failing validation -> error via 
`formatValidationErrors(validation)`
   - valid args -> updates the operator's properties; returns success
   
   ### 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]

Reply via email to