Skip to content

Commit 86654e4

Browse files
authored
Extend list_issues tests to cover Date/Number/Text field value variants
1 parent b57cd61 commit 86654e4

3 files changed

Lines changed: 92 additions & 5 deletions

File tree

pkg/github/issues_test.go

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,7 +1091,23 @@ func Test_ListIssues(t *testing.T) {
10911091
"totalCount": 3,
10921092
},
10931093
"issueFieldValues": map[string]any{
1094-
"nodes": []map[string]any{},
1094+
"nodes": []map[string]any{
1095+
{
1096+
"__typename": "IssueFieldDateValue",
1097+
"field": map[string]any{"name": "due"},
1098+
"value": "2026-06-01",
1099+
},
1100+
{
1101+
"__typename": "IssueFieldNumberValue",
1102+
"field": map[string]any{"name": "estimate"},
1103+
"valueNumber": 2.5,
1104+
},
1105+
{
1106+
"__typename": "IssueFieldTextValue",
1107+
"field": map[string]any{"name": "notes"},
1108+
"value": "needs triage",
1109+
},
1110+
},
10951111
},
10961112
},
10971113
}
@@ -1364,11 +1380,19 @@ func Test_ListIssues(t *testing.T) {
13641380
assert.NotEmpty(t, label, "Label should be a non-empty string")
13651381
}
13661382

1367-
// Field values should be flattened to {field, value} pairs. Issue #123 in the mock
1368-
// data has a SingleSelectValue for "priority"; all others have an empty list.
1369-
if issue.Number == 123 {
1383+
// Field values should be flattened to {field, value} pairs. Issue #123 has a
1384+
// SingleSelectValue; issue #456 exercises the Date/Number/Text branches
1385+
// (including float formatting); #789 has no field values.
1386+
switch issue.Number {
1387+
case 123:
13701388
assert.Equal(t, []MinimalIssueFieldValue{{Field: "priority", Value: "P1"}}, issue.FieldValues)
1371-
} else {
1389+
case 456:
1390+
assert.Equal(t, []MinimalIssueFieldValue{
1391+
{Field: "due", Value: "2026-06-01"},
1392+
{Field: "estimate", Value: "2.5"},
1393+
{Field: "notes", Value: "needs triage"},
1394+
}, issue.FieldValues)
1395+
default:
13721396
assert.Empty(t, issue.FieldValues)
13731397
}
13741398
}

script/mcp-local

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env bash
2+
# Wrapper for the locally-built github-mcp-server binary that injects a PAT from `gh auth token`.
3+
# Used by .vscode/mcp.json so VS Code's MCP client can spawn the local build with stdio transport.
4+
5+
export GITHUB_PERSONAL_ACCESS_TOKEN="$(gh auth token)"
6+
exec /workspaces/github-mcp-server/github-mcp-server stdio "$@"

tmp/pr-description.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
## Summary
2+
Adds Issues 2.0 custom field values (Priority, Visibility, Impact, etc.) to each issue returned by `list_issues`, exposed on `MinimalIssue` as `field_values: [{field, value}]`.
3+
4+
## Why
5+
Issues 2.0 introduced custom fields (single-select, number, text, date) that are core to how teams triage and prioritise. Without them in the MCP response, an agent can list issues but has no way to see — or reason about — the values teams actually filter and sort by in the GitHub UI.
6+
7+
Fixes #
8+
9+
## What changed
10+
- `IssueFragment` now selects `issueFieldValues(first: 25)` (matches monolith `IssueField::ORGANIZATION_ISSUE_FIELDS_LIMIT`).
11+
- New `IssueFieldRef` type with a `Name()` method, resolving the field name across the 4-variant `IssueFields` union.
12+
- New `IssueFieldValueFragment` union fragment over `IssueFieldDate|Number|SingleSelect|Text Value`.
13+
- `MinimalIssue` gains `FieldValues []MinimalIssueFieldValue` (`omitempty`); each entry carries `field`, `value`, and a forward-compat `values []string` for the upcoming `IssueFieldMultiSelectValue` (see github/github#430793).
14+
- `fragmentToMinimalIssueFieldValue` converts the fragment to the minimal shape.
15+
- Tests cover both label-filtered and non-label-filtered query variants.
16+
17+
### Live validation
18+
Smoke-tested against production github.com via a local build of this server, against `github/issues`:
19+
20+
```json
21+
{ "number": 21640, "field_values": [
22+
{"field":"Priority","value":"P2"},
23+
{"field":"Visibility","value":"Medium"},
24+
{"field":"Impact","value":"Medium"},
25+
{"field":"Effort","value":"Medium"}
26+
]}
27+
```
28+
29+
## MCP impact
30+
- [ ] No tool or API changes
31+
- [x] Tool schema or behavior changed
32+
- `list_issues` response now includes an optional `field_values` array per issue. Additive only, omitted for issues without custom field values, so existing consumers aren't broken.
33+
- [ ] New tool added
34+
35+
## Prompts tested (tool changes only)
36+
- "List the open issues in `github/issues` and tell me which ones are P1." — agent can now answer from the response without follow-up tool calls.
37+
- "What's the priority breakdown of open issues in `github/issues`?"
38+
39+
## Security / limits
40+
- [ ] No security or limits impact
41+
- [ ] Auth / permissions considered
42+
- [x] Data exposure, filtering, or token/size limits considered
43+
- `first: 25` caps the per-issue field array at the same limit the dotcom monolith enforces (`ORGANIZATION_ISSUE_FIELDS_LIMIT`). No new auth surface — the values are scoped to the same `repo` permission the existing query already requires.
44+
45+
## Tool renaming
46+
- [ ] I am renaming tools as part of this PR (e.g. a part of a consolidation effort)
47+
- [ ] I have added the new tool aliases in `deprecated_tool_aliases.go`
48+
- [x] I am not renaming tools as part of this PR
49+
50+
## Lint & tests
51+
- [x] Linted locally with `./script/lint`
52+
- [x] Tested locally with `./script/test`
53+
54+
## Docs
55+
- [x] Not needed
56+
- Schema is auto-generated from tool definitions; no README changes required for an additive response field.
57+
- [ ] Updated (README / docs / examples)

0 commit comments

Comments
 (0)