[test] Add tests for difc.IsSingularReadTool#8201
Open
github-actions[bot] wants to merge 1 commit into
Open
Conversation
IsSingularReadTool had 0% test coverage with no existing test file. This adds comprehensive table-driven tests covering: - Singular read tools (get_*, *_read, create_*, update_*, etc.) → true - Collection tools with list_ prefix → false - Collection tools with search_ prefix → false - Edge cases: no underscore (list, search), similar-but-different prefixes (listed_, searching_), case sensitivity (List_, SEARCH_) - Minimal inputs: empty string, single character Coverage: 0% → 100% for IsSingularReadTool Package: 99.7% → 99.9% for internal/difc Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds direct unit test coverage for internal/difc.IsSingularReadTool, ensuring the DIFC package itself exercises the list_/search_ prefix heuristic used to classify collection vs. singular tool calls.
Changes:
- Add a new table-driven test suite for
IsSingularReadToolcoveringlist_/search_prefixes and several edge cases. - Run each case as a parallel subtest for fast execution.
Show a summary per file
| File | Description |
|---|---|
| internal/difc/tool_classification_test.go | Introduces unit tests to cover IsSingularReadTool behavior across typical and edge-case tool names. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 1/1 changed files
- Comments generated: 0
- Review effort level: Low
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.
Test Coverage Improvement:
IsSingularReadToolFunction Analyzed
internal/difcIsSingularReadToolinternal/difc/tool_classification.goWhy This Function?
IsSingularReadToolhad 0% coverage with no test file at all — the clearest possible testing gap. Despite its simplicity, it plays an important semantic role in the DIFC pipeline: it distinguishes between singular read tools (e.g.get_issue,issue_read) and collection tools (e.g.list_issues,search_code). The distinction determines whether a filtered result returns an MCP error vs an empty list (see usage ininternal/server/unified.go).Tests Added
get_*,*_read,create_*,update_*,delete_*,read_*— all returntruelist_prefix:list_issues,list_commits,list_pull_requests,list_alone — all returnfalsesearch_prefix:search_code,search_issues,search_pull_requests,search_alone — all returnfalselist,search(no_) — returntruelisted_,listing_,searching_— returntrueget_list,global_search— returntrueList_,LIST_,Search_,SEARCH_(uppercase) — returntruetrueCoverage Report
Test Execution
All 29 sub-tests pass:
Generated by Test Coverage Improver
Next run should target the next most complex under-tested function (e.g.
LogUnrecognizedEndpointPassthroughat 75% orBuildVersionStringat 89.5%)Warning
Firewall blocked 7 domains
The following domains were blocked by the firewall during workflow execution:
go.opentelemetry.iogo.yaml.ingolang.orggoogle.golang.orggopkg.inproxy.golang.orgreleaseassets.githubusercontent.comSee Network Configuration for more information.