Skip to content

test(agent-service): add unit test coverage for workflow-crud-tools#6380

Merged
mengw15 merged 1 commit into
apache:mainfrom
mengw15:chore/6375-workflow-crud-tools-test
Jul 13, 2026
Merged

test(agent-service): add unit test coverage for workflow-crud-tools#6380
mengw15 merged 1 commit into
apache:mainfrom
mengw15:chore/6375-workflow-crud-tools-test

Conversation

@mengw15

@mengw15 mengw15 commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

Add unit test coverage for the operator CRUD tool factories in agent-service/src/agent/tools/workflow-crud-tools.tscreateAddOperatorTool, createModifyOperatorTool, and createDeleteOperatorTool. A bun test spec that builds each tool, calls tool.execute(args), and asserts both the returned result string and the resulting WorkflowState. No production-code changes.

The tools mutate an in-memory WorkflowState, so the spec uses a real WorkflowState and a real (in-memory, loadFromMetadata-seeded) WorkflowSystemMetadata — no network and no mocks; validation and predicate construction run through the genuine code paths.

Any related issues, documentation, discussions?

Closes #6375.

How was this PR tested?

bun test src/agent/tools/workflow-crud-tools.spec.ts

16 pass. bun run typecheck (tsc) and bun run format:check (prettier) are clean; the full bun test suite is 146 pass / 0 fail. I also verified the failure path (broke one assertion -> 1 fail, exit 1 -> reverted). Coverage:

  • delete — existing operator (removed, with connected links) / absent operator (error).
  • add — unknown operator type; missing metadata store; operatorId not matching op<number>; duplicate operatorId; properties failing validation; input port index out of range / negative; missing source operator; valid source operator; valid operator linked to an existing source.
  • modify — operator not found; merged properties failing validation; valid property + display-name update; inputOperatorIds replacing existing incoming links.

Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Code (Opus 4.8 [1M context])

@github-actions

Copy link
Copy Markdown
Contributor

Automated Reviewer Suggestions

Based on the git blame history of the changed files, we recommend the following reviewers:

  • No candidates found from git blame history.

@mengw15 mengw15 requested a review from Copilot July 12, 2026 23:54
@codecov-commenter

codecov-commenter commented Jul 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 66.80%. Comparing base (afa8af2) to head (3aa6f47).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #6380      +/-   ##
============================================
+ Coverage     66.04%   66.80%   +0.75%     
  Complexity     3380     3380              
============================================
  Files          1142     1142              
  Lines         44980    44920      -60     
  Branches       4948     4948              
============================================
+ Hits          29709    30008     +299     
+ Misses        13631    13272     -359     
  Partials       1640     1640              
Flag Coverage Δ *Carryforward flag
access-control-service 70.00% <ø> (ø) Carriedforward from afa8af2
agent-service 62.38% <ø> (+10.48%) ⬆️
amber 66.57% <ø> (ø) Carriedforward from afa8af2
computing-unit-managing-service 9.97% <ø> (ø) Carriedforward from afa8af2
config-service 52.30% <ø> (ø) Carriedforward from afa8af2
file-service 63.97% <ø> (ø) Carriedforward from afa8af2
frontend 63.51% <ø> (ø) Carriedforward from afa8af2
notebook-migration-service 78.94% <ø> (ø) Carriedforward from afa8af2
pyamber 91.18% <ø> (ø) Carriedforward from afa8af2
workflow-compiling-service 55.14% <ø> (ø) Carriedforward from afa8af2

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Bun unit tests for the agent-service workflow CRUD tool factories (createAddOperatorTool, createModifyOperatorTool, createDeleteOperatorTool) to exercise real WorkflowState mutations and real (in-memory) WorkflowSystemMetadata validation/predicate paths, without modifying production code.

Changes:

  • Introduces workflow-crud-tools.spec.ts covering success/error execution paths for add/modify/delete tools.
  • Uses an in-memory metadata store seeded via loadFromMetadata to test validation behavior with real schemas.
  • Validates tool result strings and selected WorkflowState mutations.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread agent-service/src/agent/tools/workflow-crud-tools.spec.ts Outdated
Comment thread agent-service/src/agent/tools/workflow-crud-tools.spec.ts
Comment thread agent-service/src/agent/tools/workflow-crud-tools.spec.ts
@mengw15 mengw15 force-pushed the chore/6375-workflow-crud-tools-test branch from 36df9a0 to 3aa6f47 Compare July 13, 2026 00:14
@mengw15 mengw15 requested a review from aglinxinyuan July 13, 2026 00:17

@aglinxinyuan aglinxinyuan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@mengw15 mengw15 added this pull request to the merge queue Jul 13, 2026
Merged via the queue into apache:main with commit cda063b Jul 13, 2026
20 checks passed
@mengw15 mengw15 deleted the chore/6375-workflow-crud-tools-test branch July 13, 2026 01:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add unit test coverage for agent-service workflow-crud-tools (add / modify / delete operator tools)

4 participants