Commit 8fc416b
authored
[test] Add tests for difc.IsSingularReadTool (#8201)
## 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]
> <details>
> <summary>Firewall blocked 7 domains</summary>
>
> 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:
>
> ```yaml
> 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](https://github.github.com/gh-aw/reference/network/) for
more information.
>
> </details>
> Generated by [Test Coverage
Improver](https://github.com/github/gh-aw-mcpg/actions/runs/28295403844)
· 224.6 AIC · ⊞ 7.1K ·
[◷](https://github.com/search?q=repo%3Agithub%2Fgh-aw-mcpg+%22gh-aw-workflow-id%3A+test-coverage-improver%22&type=pullrequests)
<!-- gh-aw-agentic-workflow: Test Coverage Improver, engine: copilot,
version: 1.0.63, model: claude-sonnet-4.6, id: 28295403844, workflow_id:
test-coverage-improver, run:
https://github.com/github/gh-aw-mcpg/actions/runs/28295403844 -->
<!-- gh-aw-workflow-id: test-coverage-improver -->
<!-- gh-aw-workflow-call-id: github/gh-aw-mcpg/test-coverage-improver
-->1 file changed
Lines changed: 185 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
0 commit comments