Skip to content

[test] Add tests for difc.IsSingularReadTool#8201

Open
github-actions[bot] wants to merge 1 commit into
mainfrom
add-tests-difc-is-singular-read-tool-f3a29441c02d5c99
Open

[test] Add tests for difc.IsSingularReadTool#8201
github-actions[bot] wants to merge 1 commit into
mainfrom
add-tests-difc-is-singular-read-tool-f3a29441c02d5c99

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Test Coverage Improvement: IsSingularReadTool

Function Analyzed

  • Package: internal/difc
  • Function: IsSingularReadTool
  • File: internal/difc/tool_classification.go
  • Previous Coverage: 0%
  • New Coverage: 100%
  • Package Coverage: 99.7% → 99.9%
  • Complexity: Low (single-line function with two prefix checks)

Why This Function?

IsSingularReadTool had 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 in internal/server/unified.go).

Tests Added

  • Singular read tools: get_*, *_read, create_*, update_*, delete_*, read_* — all return true
  • list_ prefix: list_issues, list_commits, list_pull_requests, list_ alone — all return false
  • search_ prefix: search_code, search_issues, search_pull_requests, search_ alone — all return false
  • No underscore edge cases: list, search (no _) — return true
  • Similar-but-non-matching prefixes: listed_, listing_, searching_ — return true
  • Names containing keywords mid-string: get_list, global_search — return true
  • Case sensitivity: List_, LIST_, Search_, SEARCH_ (uppercase) — return true
  • Boundary inputs: empty string, single character — return true

Coverage Report

Before: 0.0% coverage  (IsSingularReadTool)
After:  100.0% coverage (IsSingularReadTool)
Package improvement: 99.7% → 99.9%

Test Execution

All 29 sub-tests pass:

--- PASS: TestIsSingularReadTool (0.00s)
    (29 sub-tests all PASS)
ok  github.com/github/gh-aw-mcpg/internal/difc  0.005s  coverage: 99.9% of statements

Generated by Test Coverage Improver
Next run should target the next most complex under-tested function (e.g. LogUnrecognizedEndpointPassthrough at 75% or BuildVersionString at 89.5%)

Warning

Firewall blocked 7 domains

The following domains were blocked by the firewall during workflow execution:

  • go.opentelemetry.io
  • go.yaml.in
  • golang.org
  • google.golang.org
  • gopkg.in
  • proxy.golang.org
  • releaseassets.githubusercontent.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "go.opentelemetry.io"
    - "go.yaml.in"
    - "golang.org"
    - "google.golang.org"
    - "gopkg.in"
    - "proxy.golang.org"
    - "releaseassets.githubusercontent.com"

See Network Configuration for more information.

Generated by Test Coverage Improver · 224.6 AIC · ⊞ 7.1K ·

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>
@lpcox lpcox marked this pull request as ready for review June 27, 2026 17:57
Copilot AI review requested due to automatic review settings June 27, 2026 17:57

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 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 IsSingularReadTool covering list_/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

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.

1 participant