Skip to content

Commit 592af2c

Browse files
committed
fixing suggestions
1 parent 8d786bd commit 592af2c

6 files changed

Lines changed: 64 additions & 134 deletions

File tree

docs/feature-flags.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ runtime behavior (such as output formatting) won't appear here.
177177

178178
- **update_issue_type** - Update Issue Type
179179
- **Required OAuth Scopes**: `repo`
180-
- `is_suggestion`: If true, propose the issue type change instead of applying it. Defaults to false, which applies the change to the issue. (boolean, optional)
180+
- `is_suggestion`: If true, this issue type change is sent to the API as a suggestion (suggest:true) rather than an applied value. Whether the type is applied or recorded as a proposal is determined by the API. (boolean, optional)
181181
- `issue_number`: The issue number to update (number, required)
182182
- `issue_type`: The issue type to set (string, required)
183183
- `owner`: Repository owner (username or organization) (string, required)

pkg/github/__toolsnaps__/set_issue_fields.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"type": "string"
2525
},
2626
"is_suggestion": {
27-
"description": "If true, propose this field value instead of applying it. Fields not marked as suggestions are applied to the issue; suggested fields are returned as proposals in the response.",
27+
"description": "If true, this field value is sent to the API as a suggestion (suggest:true) rather than an applied value. Whether the value is applied or recorded as a proposal is determined by the API.",
2828
"type": "boolean"
2929
},
3030
"number_value": {

pkg/github/__toolsnaps__/update_issue_labels.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
{
2424
"properties": {
2525
"is_suggestion": {
26-
"description": "If true, propose this label instead of applying it. Labels not marked as suggestions are applied to the issue; suggested labels are returned as proposals in the response.",
26+
"description": "If true, this label is sent to the API as a suggestion (suggest:true) rather than an applied label. Whether the label is applied or recorded as a proposal is determined by the API.",
2727
"type": "boolean"
2828
},
2929
"name": {

pkg/github/__toolsnaps__/update_issue_type.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"inputSchema": {
99
"properties": {
1010
"is_suggestion": {
11-
"description": "If true, propose the issue type change instead of applying it. Defaults to false, which applies the change to the issue.",
11+
"description": "If true, this issue type change is sent to the API as a suggestion (suggest:true) rather than an applied value. Whether the type is applied or recorded as a proposal is determined by the API.",
1212
"type": "boolean"
1313
},
1414
"issue_number": {

pkg/github/granular_tools_test.go

Lines changed: 29 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package github
22

33
import (
44
"context"
5-
"encoding/json"
65
"net/http"
76
"strings"
87
"testing"
@@ -463,62 +462,58 @@ func TestGranularUpdateIssueTypeSuggest(t *testing.T) {
463462
tests := []struct {
464463
name string
465464
requestArgs map[string]any
466-
expected map[string]any
465+
expectedReq map[string]any
467466
}{
468467
{
469468
name: "suggest without rationale",
470469
requestArgs: map[string]any{
471-
"owner": "owner",
472-
"repo": "repo",
473-
"issue_number": float64(1),
474-
"issue_type": "bug",
475-
"suggest": true,
470+
"owner": "owner",
471+
"repo": "repo",
472+
"issue_number": float64(1),
473+
"issue_type": "bug",
474+
"is_suggestion": true,
476475
},
477-
expected: map[string]any{
478-
"owner": "owner",
479-
"repo": "repo",
480-
"issue_number": float64(1),
481-
"issue_type": "bug",
482-
"suggested": true,
476+
expectedReq: map[string]any{
477+
"type": map[string]any{
478+
"value": "bug",
479+
"suggest": true,
480+
},
483481
},
484482
},
485483
{
486484
name: "suggest with rationale",
487485
requestArgs: map[string]any{
488-
"owner": "owner",
489-
"repo": "repo",
490-
"issue_number": float64(1),
491-
"issue_type": "feature",
492-
"rationale": " Asks for dark mode support ",
493-
"suggest": true,
486+
"owner": "owner",
487+
"repo": "repo",
488+
"issue_number": float64(1),
489+
"issue_type": "feature",
490+
"rationale": " Asks for dark mode support ",
491+
"is_suggestion": true,
494492
},
495-
expected: map[string]any{
496-
"owner": "owner",
497-
"repo": "repo",
498-
"issue_number": float64(1),
499-
"issue_type": "feature",
500-
"rationale": "Asks for dark mode support",
501-
"suggested": true,
493+
expectedReq: map[string]any{
494+
"type": map[string]any{
495+
"value": "feature",
496+
"rationale": "Asks for dark mode support",
497+
"suggest": true,
498+
},
502499
},
503500
},
504501
}
505502

506503
for _, tc := range tests {
507504
t.Run(tc.name, func(t *testing.T) {
508-
// No HTTP handler registered: any API call would fail the test.
509-
deps := BaseDeps{Client: mustNewGHClient(t, MockHTTPClientWithHandlers(nil))}
505+
client := mustNewGHClient(t, MockHTTPClientWithHandlers(map[string]http.HandlerFunc{
506+
PatchReposIssuesByOwnerByRepoByIssueNumber: expectRequestBody(t, tc.expectedReq).
507+
andThen(mockResponse(t, http.StatusOK, &gogithub.Issue{Number: gogithub.Ptr(1)})),
508+
}))
509+
deps := BaseDeps{Client: client}
510510
serverTool := GranularUpdateIssueType(translations.NullTranslationHelper)
511511
handler := serverTool.Handler(deps)
512512

513513
request := createMCPRequest(tc.requestArgs)
514514
result, err := handler(ContextWithDeps(context.Background(), deps), &request)
515515
require.NoError(t, err)
516-
require.False(t, result.IsError)
517-
518-
textContent := getTextResult(t, result)
519-
var got map[string]any
520-
require.NoError(t, json.Unmarshal([]byte(textContent.Text), &got))
521-
assert.Equal(t, tc.expected, got)
516+
assert.False(t, result.IsError)
522517
})
523518
}
524519
}

0 commit comments

Comments
 (0)