test(java): add arity 0 and arity 2 coverage to ErgonomicToolDefinitionIT#1897
Conversation
…onIT Both the annotation-based (ErgonomicTestTools) and lambda-based (ToolDefinition.from()) APIs previously only exercised arity 1. This commit adds: - ErgonomicTestTools.getStatus() — zero-parameter @copilotTool - ErgonomicTestTools.combineValues(String, String) — two-parameter @copilotTool - ergonomicToolArity0 / lambdaToolArity0 test methods (Supplier overload) - ergonomicToolArity2 / lambdaToolArity2 test methods (BiFunction overload) - test/snapshots/tools/ergonomic_tool_arity0.yaml - test/snapshots/tools/ergonomic_tool_arity2.yaml Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Extends the Java E2E integration coverage for tool-definition ergonomics by exercising arity 0 and arity 2 tool handlers for both the annotation-based (@CopilotTool + ToolDefinition.fromObject) and lambda-based (ToolDefinition.from(...)) APIs, using replay-proxy snapshots under test/snapshots/tools/.
Changes:
- Added new zero-arg and two-arg E2E test cases in
ErgonomicToolDefinitionITfor both annotation-based and lambda-based tool definitions. - Added two new tool fixture methods (
getStatus,combineValues) toErgonomicTestToolsto cover arity 0 and 2 for the annotation-based path. - Added new replay snapshots for the new arity scenarios.
Show a summary per file
| File | Description |
|---|---|
java/src/test/java/com/github/copilot/e2e/ErgonomicToolDefinitionIT.java |
Adds arity 0 and arity 2 E2E coverage for both annotation-based and lambda-based tool definitions. |
java/src/test/java/com/github/copilot/e2e/ErgonomicTestTools.java |
Adds @CopilotTool methods to exercise zero-parameter and two-parameter annotation-based tools. |
test/snapshots/tools/ergonomic_tool_arity0.yaml |
New replay snapshot for the arity-0 tool invocation flow (get_status). |
test/snapshots/tools/ergonomic_tool_arity2.yaml |
New replay snapshot for the arity-2 tool invocation flow (combine_values). |
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 0
- Review effort level: Low
This comment has been minimized.
This comment has been minimized.
…CopilotToolMeta The hand-written ErgonomicTestTools$$CopilotToolMeta.java fixture only defined set_current_phase and search_items, but the ergonomicToolArity0 and ergonomicToolArity2 tests expect get_status and combine_values to be registered. This caused the replay proxy to fail with "Tool does not exist" errors in CI. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Cross-SDK Consistency Review ✅This PR adds arity 0 and arity 2 test coverage to the Java No cross-SDK consistency issues found. Here's why: Java-specific APIs being testedThe
SnapshotsThe two new YAML snapshots ( No action needed in other SDK implementations.
|
Both the annotation-based (ErgonomicTestTools) and lambda-based (ToolDefinition.from()) APIs previously only exercised arity 1.
This commit adds: