Conversation
… and sink server IDs Add tests for two untested functions: - internal/mcp/tool_result_test.go: tests ConvertToCallToolResult (JSON array wrapping, standard MCP content conversion, empty content, isError propagation, unknown type fallback, no-content-field wrapping) and ParseToolArguments (nil args, valid JSON, nested objects, invalid JSON error, empty object). - internal/difc/sink_server_ids_test.go: tests SetSinkServerIDs (clear on empty/nil, match configured IDs, deduplication, empty string skip, replace previous config) and IsSinkServerID (no config, exact match, partial non-match, case sensitivity, concurrent safety). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds new unit test coverage for MCP tool-result handling and DIFC sink server ID configuration, strengthening validation of core conversion/parsing helpers and the sink-ID matching behavior.
Changes:
- Added unit tests for
ConvertToCallToolResultcovering common backend payload shapes and edge cases. - Added unit tests for
ParseToolArgumentscovering nil/valid/invalid JSON argument handling. - Added unit tests for
SetSinkServerIDs/IsSinkServerIDcovering clearing, dedup/skip-empty behavior, and matching semantics.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| internal/mcp/tool_result_test.go | Adds unit tests for tool result conversion and tool-argument parsing helpers. |
| internal/difc/sink_server_ids_test.go | Adds unit tests for sink server ID configuration and matching behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| result, err := ConvertToCallToolResult(nil) | ||
|
|
||
| require.NoError(t, err) | ||
| require.NotNil(t, result) |
Comment on lines
+107
to
+111
| wg.Add(1) | ||
| go func() { | ||
| defer wg.Done() | ||
| _ = IsSinkServerID("concurrent-server") | ||
| }() |
This was referenced Mar 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 This PR was created by Repo Assist, an automated AI assistant.
Summary
Adds unit tests for two previously untested modules:
internal/mcp/tool_result_test.goTests
ConvertToCallToolResult— the backend result conversion function:TextContentitemisError: trueis propagated to the resultcontentfield is wrapped as text"image") fall back to textTests
ParseToolArguments— argument extraction fromCallToolRequest:Argumentsreturns an empty map (not nil){}returns empty mapinternal/difc/sink_server_ids_test.goTests
SetSinkServerIDs:Tests
IsSinkServerID:falsewhen no IDs are configuredtruefor exact matchfalsefor partial/prefix/suffix matchessync.WaitGroupgoroutine test)Test Status
Warning
The following domain was blocked by the firewall during workflow execution:
proxy.golang.orgTo allow these domains, add them to the
network.allowedlist in your workflow frontmatter:See Network Configuration for more information.