Approved · 0 retained findingsgithub/github-mcp-server#2941
Support singular Project Issue Field updates
Input
PR author’s description
Summary
Adds focused attached Issue Field support to singular update_project_item name-form writes. This PR is stacked on #2903.
PR diff
Current GitHub diff ↗+type setIssueFieldValueMutation struct {+ SetIssueFieldValue struct {+ Issue struct {+ ID githubv4.ID
Browse 6 changed files
pkg/github/issues_granular.go+24 −30
@@ -1274,6 +1274,27 @@ type IssueFieldCreateOrUpdateInput struct { Suggest *githubv4.Boolean `json:"suggest,omitempty"` } +type setIssueFieldValueMutation struct {+ SetIssueFieldValue struct {+ Issue struct {+ ID githubv4.ID+ URL githubv4.String+ }+ } `graphql:"setIssueFieldValue(input: $input)"`+}++// SetIssueFieldValues updates Issue Field values and returns the updated issue.+func SetIssueFieldValues(ctx context.Context, gqlClient *githubv4.Client, input SetIssueFieldValueInput) (MinimalResponse, error) {+ var mutation setIssueFieldValueMutation+ if err := gqlClient.Mutate(ctx, &mutation, input, nil); err != nil {+ return MinimalResponse{}, err+ }+ return MinimalResponse{+ ID: fmt.Sprintf("%v", mutation.SetIssueFieldValue.Issue.ID),+ URL: string(mutation.SetIssueFieldValue.Issue.URL),+ }, nil+}+ // GranularSetIssueFields creates a tool to set issue field values on an issue using GraphQL. func GranularSetIssueFields(t translations.TranslationHelperFunc) inventory.ServerTool { st := NewTool(@@ -1497,31 +1518,6 @@ func GranularSetIssueFields(t translations.TranslationHelperFunc) inventory.Serv return ghErrors.NewGitHubGraphQLErrorResponse(ctx, "failed to get issue", err), nil, nil } - // Execute the setIssueFieldValue mutation- var mutation struct {- SetIssueFieldValue struct {- Issue struct {- ID githubv4.ID- Number githubv4.Int- URL githubv4.String- }- IssueFieldValues []struct {- TextValue struct {- Value string- } `graphql:"... on IssueFieldTextValue"`- SingleSelectValue struct {- Name string- } `graphql:"... on IssueFieldSingleSelectValue"`- DateValue struct {- Value string- } `graphql:"... on IssueFieldDateValue"`- NumberValue struct {- Value float64- } `graphql:"... on IssueFieldNumberValue"`- }- } `graphql:"setIssueFieldValue(input: $input)"`- }- mutationInput := SetIssueFieldValueInput{ IssueID: issueID, IssueFields: issueFields,@@ -1530,14 +1526,12 @@ func GranularSetIssueFields(t translations.TranslationHelperFunc) inventory.Serv // The rationale and suggest input fields on IssueFieldCreateOrUpdateInput // are gated behind the update_issue_suggestions GraphQL feature flag. ctxWithFeatures := ghcontext.WithGraphQLFeatures(ctx, "update_issue_suggestions")- if err := gqlClient.Mutate(ctxWithFeatures, &mutation, mutationInput, nil); err != nil {+ response, err := SetIssueFieldValues(ctxWithFeatures, gqlClient, mutationInput)+ if err != nil { return ghErrors.NewGitHubGraphQLErrorResponse(ctx, "failed to set issue field values", err), nil, nil } - r, err := json.Marshal(MinimalResponse{- ID: fmt.Sprintf("%v", mutation.SetIssueFieldValue.Issue.ID),- URL: string(mutation.SetIssueFieldValue.Issue.URL),- })+ r, err := json.Marshal(response) if err != nil { return utils.NewToolResultErrorFromErr("failed to marshal response", err), nil, nil }
pkg/github/projects.go+207 −31
@@ -10,6 +10,7 @@ import ( "strconv" "time" + ghcontext "github.com/github/github-mcp-server/pkg/context" ghErrors "github.com/github/github-mcp-server/pkg/errors" "github.com/github/github-mcp-server/pkg/ifc" "github.com/github/github-mcp-server/pkg/inventory"@@ -1192,23 +1193,7 @@ func getProjectField(ctx context.Context, client *github.Client, owner, ownerTyp } func getProjectItem(ctx context.Context, client *github.Client, owner, ownerType string, projectNumber int, itemID int64, fields []int64) (*mcp.CallToolResult, any, error) {- var resp *github.Response- var projectItem *github.ProjectV2Item- var opts *github.GetProjectItemOptions- var err error-- if len(fields) > 0 {- opts = &github.GetProjectItemOptions{- Fields: fields,- }- }-- if ownerType == "org" {- projectItem, resp, err = client.Projects.GetOrganizationProjectItem(ctx, owner, projectNumber, itemID, opts)- } else {- projectItem, resp, err = client.Projects.GetUserProjectItem(ctx, owner, projectNumber, itemID, opts)- }-+ projectItem, resp, err := fetchProjectItem(ctx, client, owner, ownerType, projectNumber, itemID, fields) if err != nil { return ghErrors.NewGitHubAPIErrorResponse(ctx, "failed to get project item",@@ -1234,8 +1219,29 @@ func getProjectItem(ctx context.Context, client *github.Client, owner, ownerType return utils.NewToolResultText(string(r)), nil, nil } +func fetchProjectItem(ctx context.Context, client *github.Client, owner, ownerType string, projectNumber int, itemID int64, fields []int64) (*github.ProjectV2Item, *github.Response, error) {+ var resp *github.Response+ var projectItem *github.ProjectV2Item+ var opts *github.GetProjectItemOptions+ var err error++ if len(fields) > 0 {+ opts = &github.GetProjectItemOptions{+ Fields: fields,+ }+ }++ if ownerType == "org" {+ projectItem, resp, err = client.Projects.GetOrganizationProjectItem(ctx, owner, projectNumber, itemID, opts)+ } else {+ projectItem, resp, err = client.Projects.GetUserProjectItem(ctx, owner, projectNumber, itemID, opts)+ }++ return projectItem, resp, err+}+ func updateProjectItem(ctx context.Context, client *github.Client, gqlClient *githubv4.Client, owner, ownerType string, projectNumber int, itemID int64, fieldValue map[string]any) (*mcp.CallToolResult, any, error) {- updatePayload, err := buildUpdateProjectItem(ctx, gqlClient, owner, ownerType, projectNumber, fieldValue)+ updatePayload, issueField, err := buildUpdateProjectItem(ctx, gqlClient, owner, ownerType, projectNumber, fieldValue) if err != nil { var structured *ghErrors.StructuredResolutionError if errors.As(err, &structured) {@@ -1244,6 +1250,47 @@ func updateProjectItem(ctx context.Context, client *github.Client, gqlClient *gi return utils.NewToolResultError(err.Error()), nil, nil } + if issueField != nil {+ projectItem, resp, fetchErr := fetchProjectItem(ctx, client, owner, ownerType, projectNumber, itemID, nil)+ if fetchErr != nil {+ return ghErrors.NewGitHubAPIErrorResponse(ctx, "failed to get project item", resp, fetchErr), nil, nil+ }+ defer func() { _ = resp.Body.Close() }()+ if resp.StatusCode != http.StatusOK {+ body, readErr := io.ReadAll(resp.Body)+ if readErr != nil {+ return nil, nil, fmt.Errorf("failed to read response body: %w", readErr)+ }+ return ghErrors.NewGitHubAPIStatusErrorResponse(ctx, "failed to get project item", resp, body), nil, nil+ }++ issueID, resolveErr := projectItemIssueID(projectItem)+ if resolveErr != nil {+ var structured *ghErrors.StructuredResolutionError+ if errors.As(resolveErr, &structured) {+ return ghErrors.NewStructuredResolutionErrorResponse(structured), nil, nil+ }+ return utils.NewToolResultError(resolveErr.Error()), nil, nil+ }++ // The setIssueFieldValue mutation is gated behind the update_issue_suggestions+ // GraphQL feature flag, matching the set_issue_fields tool.+ ctxWithFeatures := ghcontext.WithGraphQLFeatures(ctx, "update_issue_suggestions")+ response, mutationErr := SetIssueFieldValues(ctxWithFeatures, gqlClient, SetIssueFieldValueInput{+ IssueID: issueID,+ IssueFields: []IssueFieldCreateOrUpdateInput{*issueField},+ })+ if mutationErr != nil {+ return ghErrors.NewGitHubGraphQLErrorResponse(ctx, "failed to set issue field value", mutationErr), nil, nil+ }++ r, marshalErr := json.Marshal(response)+ if marshalErr != nil {+ return nil, nil, fmt.Errorf("failed to marshal response: %w", marshalErr)+ }+ return utils.NewToolResultText(string(r)), nil, nil+ }+ var resp *github.Response var updatedItem *github.ProjectV2Item @@ -1277,6 +1324,42 @@ func updateProjectItem(ctx context.Context, client *github.Client, gqlClient *gi return utils.NewToolResultText(string(r)), nil, nil } +func projectItemIssueID(item *github.ProjectV2Item) (githubv4.ID, error) {+ if item == nil {+ return nil, ghErrors.NewStructuredResolutionError(+ "missing_metadata",+ "",+ "project item metadata is missing",+ nil,+ )+ }++ contentType := ""+ if item.ContentType != nil {+ contentType = string(*item.ContentType)+ }+ if contentType != string(github.ProjectV2ItemContentTypeIssue) {+ return nil, ghErrors.NewStructuredResolutionError(+ "unsupported_item_type",+ contentType,+ "attached Issue Fields can only be updated on Issue project items",+ nil,+ )+ }++ content := item.GetContent()+ if content == nil || content.GetIssue() == nil || content.GetIssue().GetNodeID() == "" {+ return nil, ghErrors.NewStructuredResolutionError(+ "missing_metadata",+ contentType,+ "project Issue item is missing its Issue node ID",+ nil,+ )+ }++ return githubv4.ID(content.GetIssue().GetNodeID()), nil+}+ func deleteProjectItem(ctx context.Context, client *github.Client, owner, ownerType string, projectNumber int, itemID int64) (*mcp.CallToolResult, any, error) { var resp *github.Response var err error@@ -1614,25 +1697,25 @@ func validateAndConvertToInt64(value any) (int64, error) { } } -// buildUpdateProjectItem builds UpdateProjectItemOptions, resolving field names and SINGLE_SELECT option names server-side.-func buildUpdateProjectItem(ctx context.Context, gqlClient *githubv4.Client, owner, ownerType string, projectNumber int, input map[string]any) (*github.UpdateProjectItemOptions, error) {+// buildUpdateProjectItem builds either a standard Project update or an attached Issue Field update.+func buildUpdateProjectItem(ctx context.Context, gqlClient *githubv4.Client, owner, ownerType string, projectNumber int, input map[string]any) (*github.UpdateProjectItemOptions, *IssueFieldCreateOrUpdateInput, error) { if input == nil {- return nil, fmt.Errorf("updated_field must be an object")+ return nil, nil, fmt.Errorf("updated_field must be an object") } valueField, hasValue := input["value"] if !hasValue {- return nil, fmt.Errorf("updated_field.value is required")+ return nil, nil, fmt.Errorf("updated_field.value is required") } idField, hasID := input["id"] nameField, hasName := input["name"] switch { case hasID && hasName:- return nil, fmt.Errorf("updated_field must set either id or name, not both")+ return nil, nil, fmt.Errorf("updated_field must set either id or name, not both") case !hasID && !hasName:- return nil, fmt.Errorf("updated_field requires either id or name")+ return nil, nil, fmt.Errorf("updated_field requires either id or name") } var (@@ -1644,24 +1727,37 @@ func buildUpdateProjectItem(ctx context.Context, gqlClient *githubv4.Client, own var err error fieldID, err = validateAndConvertToInt64(idField) if err != nil {- return nil, fmt.Errorf("updated_field.id: %w", err)+ return nil, nil, fmt.Errorf("updated_field.id: %w", err) } } else { fieldName, ok := nameField.(string) if !ok || fieldName == "" {- return nil, fmt.Errorf("updated_field.name must be a non-empty string")+ return nil, nil, fmt.Errorf("updated_field.name must be a non-empty string") } if gqlClient == nil {- return nil, fmt.Errorf("internal error: gqlClient is required to resolve updated_field.name")+ return nil, nil, fmt.Errorf("internal error: gqlClient is required to resolve updated_field.name") } var err error resolved, err = resolveProjectFieldByName(ctx, gqlClient, owner, ownerType, projectNumber, fieldName, "") if err != nil {- return nil, err+ return nil, nil, err+ }+ if supportsIssueFieldUpdate(resolved.DataType) {+ resolved, err = resolveIssueFieldForUpdate(ctx, gqlClient, owner, ownerType, projectNumber, resolved)+ if err != nil {+ return nil, nil, err+ }+ if resolved.IsIssueField {+ issueField, buildErr := buildIssueFieldUpdate(resolved, valueField)+ if buildErr != nil {+ return nil, nil, buildErr+ }+ return nil, issueField, nil+ } } parsedID, parseErr := parseInt64(resolved.ID) if parseErr != nil {- return nil, fmt.Errorf("resolved field %q has non-numeric ID %q; pass updated_field.id directly", resolved.Name, resolved.ID)+ return nil, nil, fmt.Errorf("resolved field %q has non-numeric ID %q; pass updated_field.id directly", resolved.Name, resolved.ID) } fieldID = parsedID }@@ -1681,7 +1777,7 @@ func buildUpdateProjectItem(ctx context.Context, gqlClient *githubv4.Client, own } } if !known {- return nil, optErr+ return nil, nil, optErr } } }@@ -1694,7 +1790,87 @@ func buildUpdateProjectItem(ctx context.Context, gqlClient *githubv4.Client, own }}, } - return payload, nil+ return payload, nil, nil+}++func supportsIssueFieldUpdate(dataType string) bool {+ switch dataType {+ case "TEXT", "NUMBER", "DATE", "SINGLE_SELECT":+ return true+ default:+ return false+ }+}++func buildIssueFieldUpdate(field *ResolvedField, value any) (*IssueFieldCreateOrUpdateInput, error) {+ if !supportsIssueFieldUpdate(field.DataType) {+ return nil, ghErrors.NewStructuredResolutionError(+ "unsupported_field_type",+ field.Name,+ fmt.Sprintf("attached Issue Field %q has unsupported data type %q", field.Name, field.DataType),+ nil,+ )+ }++ if field.IssueFieldID == "" {+ return nil, ghErrors.NewStructuredResolutionError(+ "missing_field_metadata",+ field.Name,+ fmt.Sprintf("attached Issue Field %q is missing its Issue Field node ID", field.Name),+ nil,+ )+ }++ input := &IssueFieldCreateOrUpdateInput{FieldID: githubv4.ID(field.IssueFieldID)}+ if value == nil {+ input.Delete = githubv4.NewBoolean(githubv4.Boolean(true))+ return input, nil+ }++ switch field.DataType {+ case "TEXT":+ text, ok := value.(string)+ if !ok {+ return nil, invalidIssueFieldValue(field, "value must be a string")+ }+ input.TextValue = githubv4.NewString(githubv4.String(text))+ case "NUMBER":+ number, ok := toFloat64(value)+ if !ok {+ return nil, invalidIssueFieldValue(field, "value must be a number")+ }+ input.NumberValue = githubv4.NewFloat(githubv4.Float(number))+ case "DATE":+ date, ok := value.(string)+ if !ok {+ return nil, invalidIssueFieldValue(field, "value must be a date string in YYYY-MM-DD format")+ }+ if _, err := time.Parse(time.DateOnly, date); err != nil {+ return nil, invalidIssueFieldValue(field, "value must be a valid date in YYYY-MM-DD format")+ }+ input.DateValue = githubv4.NewString(githubv4.String(date))+ case "SINGLE_SELECT":+ optionName, ok := value.(string)+ if !ok || optionName == "" {+ return nil, invalidIssueFieldValue(field, "value must be a non-empty option name")+ }+ optionID, err := resolveSingleSelectOptionByName(field, optionName)+ if err != nil {+ return nil, err+ }+ input.SingleSelectOptionID = githubv4.NewID(githubv4.ID(optionID))+ }++ return input, nil+}++func invalidIssueFieldValue(field *ResolvedField, hint string) error {+ return ghErrors.NewStructuredResolutionError(+ "invalid_field_value",+ field.Name,+ fmt.Sprintf("invalid value for attached Issue Field %q: %s", field.Name, hint),+ nil,+ ) } func extractPaginationOptionsFromArgs(args map[string]any) (github.ListProjectsPaginationOptions, error) {
pkg/github/granular_tools_test.go+39 −156
@@ -1798,6 +1798,27 @@ func TestGranularUnresolveReviewThread(t *testing.T) { } func TestGranularSetIssueFields(t *testing.T) {+ t.Run("mutation selects only issue identity", func(t *testing.T) {+ transport := &sequencedGraphQLTransport{+ t: t,+ responses: []func(capturedGraphQLRequest) (int, string){+ func(req capturedGraphQLRequest) (int, string) {+ assert.Contains(t, req.Query, "issue{id,url}")+ assert.NotContains(t, req.Query, "issueFieldValues")+ assert.NotContains(t, req.Query, "number")+ return http.StatusOK, `{"data":{"setIssueFieldValue":{"issue":{"id":"ISSUE_123","url":"https://github.com/owner/repo/issues/5"}}}}`+ },+ },+ }+ _, err := SetIssueFieldValues(context.Background(), githubv4.NewClient(&http.Client{Transport: transport}), SetIssueFieldValueInput{+ IssueID: githubv4.ID("ISSUE_123"),+ IssueFields: []IssueFieldCreateOrUpdateInput{{+ FieldID: githubv4.ID("FIELD_1"), TextValue: githubv4.NewString("hello"),+ }},+ })+ require.NoError(t, err)+ })+ t.Run("successful set with text value", func(t *testing.T) { matchers := []githubv4mock.Matcher{ // Mock the issue ID query@@ -1822,29 +1843,7 @@ func TestGranularSetIssueFields(t *testing.T) { ), // Mock the setIssueFieldValue mutation githubv4mock.NewMutationMatcher(- struct {- SetIssueFieldValue struct {- Issue struct {- ID githubv4.ID- Number githubv4.Int- URL githubv4.String- }- IssueFieldValues []struct {- TextValue struct {- Value string- } `graphql:"... on IssueFieldTextValue"`- SingleSelectValue struct {- Name string- } `graphql:"... on IssueFieldSingleSelectValue"`- DateValue struct {- Value string- } `graphql:"... on IssueFieldDateValue"`- NumberValue struct {- Value float64- } `graphql:"... on IssueFieldNumberValue"`- }- } `graphql:"setIssueFieldValue(input: $input)"`- }{},+ setIssueFieldValueMutation{}, SetIssueFieldValueInput{ IssueID: githubv4.ID("ISSUE_123"), IssueFields: []IssueFieldCreateOrUpdateInput{@@ -1858,9 +1857,8 @@ func TestGranularSetIssueFields(t *testing.T) { githubv4mock.DataResponse(map[string]any{ "setIssueFieldValue": map[string]any{ "issue": map[string]any{- "id": "ISSUE_123",- "number": 5,- "url": "https://github.com/owner/repo/issues/5",+ "id": "ISSUE_123",+ "url": "https://github.com/owner/repo/issues/5", }, }, }),@@ -1997,29 +1995,7 @@ func TestGranularSetIssueFields(t *testing.T) { }), ), githubv4mock.NewMutationMatcher(- struct {- SetIssueFieldValue struct {- Issue struct {- ID githubv4.ID- Number githubv4.Int- URL githubv4.String- }- IssueFieldValues []struct {- TextValue struct {- Value string- } `graphql:"... on IssueFieldTextValue"`- SingleSelectValue struct {- Name string- } `graphql:"... on IssueFieldSingleSelectValue"`- DateValue struct {- Value string- } `graphql:"... on IssueFieldDateValue"`- NumberValue struct {- Value float64- } `graphql:"... on IssueFieldNumberValue"`- }- } `graphql:"setIssueFieldValue(input: $input)"`- }{},+ setIssueFieldValueMutation{}, SetIssueFieldValueInput{ IssueID: githubv4.ID("ISSUE_123"), IssueFields: []IssueFieldCreateOrUpdateInput{@@ -2034,9 +2010,8 @@ func TestGranularSetIssueFields(t *testing.T) { githubv4mock.DataResponse(map[string]any{ "setIssueFieldValue": map[string]any{ "issue": map[string]any{- "id": "ISSUE_123",- "number": 5,- "url": "https://github.com/owner/repo/issues/5",+ "id": "ISSUE_123",+ "url": "https://github.com/owner/repo/issues/5", }, }, }),@@ -2111,29 +2086,7 @@ func TestGranularSetIssueFields(t *testing.T) { }), ), githubv4mock.NewMutationMatcher(- struct {- SetIssueFieldValue struct {- Issue struct {- ID githubv4.ID- Number githubv4.Int- URL githubv4.String- }- IssueFieldValues []struct {- TextValue struct {- Value string- } `graphql:"... on IssueFieldTextValue"`- SingleSelectValue struct {- Name string- } `graphql:"... on IssueFieldSingleSelectValue"`- DateValue struct {- Value string- } `graphql:"... on IssueFieldDateValue"`- NumberValue struct {- Value float64- } `graphql:"... on IssueFieldNumberValue"`- }- } `graphql:"setIssueFieldValue(input: $input)"`- }{},+ setIssueFieldValueMutation{}, SetIssueFieldValueInput{ IssueID: githubv4.ID("ISSUE_123"), IssueFields: []IssueFieldCreateOrUpdateInput{@@ -2148,9 +2101,8 @@ func TestGranularSetIssueFields(t *testing.T) { githubv4mock.DataResponse(map[string]any{ "setIssueFieldValue": map[string]any{ "issue": map[string]any{- "id": "ISSUE_123",- "number": 5,- "url": "https://github.com/owner/repo/issues/5",+ "id": "ISSUE_123",+ "url": "https://github.com/owner/repo/issues/5", }, }, }),@@ -2225,29 +2177,7 @@ func TestGranularSetIssueFields(t *testing.T) { }), ), githubv4mock.NewMutationMatcher(- struct {- SetIssueFieldValue struct {- Issue struct {- ID githubv4.ID- Number githubv4.Int- URL githubv4.String- }- IssueFieldValues []struct {- TextValue struct {- Value string- } `graphql:"... on IssueFieldTextValue"`- SingleSelectValue struct {- Name string- } `graphql:"... on IssueFieldSingleSelectValue"`- DateValue struct {- Value string- } `graphql:"... on IssueFieldDateValue"`- NumberValue struct {- Value float64- } `graphql:"... on IssueFieldNumberValue"`- }- } `graphql:"setIssueFieldValue(input: $input)"`- }{},+ setIssueFieldValueMutation{}, SetIssueFieldValueInput{ IssueID: githubv4.ID("ISSUE_123"), IssueFields: []IssueFieldCreateOrUpdateInput{@@ -2262,9 +2192,8 @@ func TestGranularSetIssueFields(t *testing.T) { githubv4mock.DataResponse(map[string]any{ "setIssueFieldValue": map[string]any{ "issue": map[string]any{- "id": "ISSUE_123",- "number": 5,- "url": "https://github.com/owner/repo/issues/5",+ "id": "ISSUE_123",+ "url": "https://github.com/owner/repo/issues/5", }, }, }),@@ -2316,29 +2245,7 @@ func TestGranularSetIssueFields(t *testing.T) { }), ), githubv4mock.NewMutationMatcher(- struct {- SetIssueFieldValue struct {- Issue struct {- ID githubv4.ID- Number githubv4.Int- URL githubv4.String- }- IssueFieldValues []struct {- TextValue struct {- Value string- } `graphql:"... on IssueFieldTextValue"`- SingleSelectValue struct {- Name string- } `graphql:"... on IssueFieldSingleSelectValue"`- DateValue struct {- Value string- } `graphql:"... on IssueFieldDateValue"`- NumberValue struct {- Value float64- } `graphql:"... on IssueFieldNumberValue"`- }- } `graphql:"setIssueFieldValue(input: $input)"`- }{},+ setIssueFieldValueMutation{}, SetIssueFieldValueInput{ IssueID: githubv4.ID("ISSUE_123"), IssueFields: []IssueFieldCreateOrUpdateInput{@@ -2354,9 +2261,8 @@ func TestGranularSetIssueFields(t *testing.T) { githubv4mock.DataResponse(map[string]any{ "setIssueFieldValue": map[string]any{ "issue": map[string]any{- "id": "ISSUE_123",- "number": 5,- "url": "https://github.com/owner/repo/issues/5",+ "id": "ISSUE_123",+ "url": "https://github.com/owner/repo/issues/5", }, }, }),@@ -2408,29 +2314,7 @@ func TestGranularSetIssueFields(t *testing.T) { }), ), githubv4mock.NewMutationMatcher(- struct {- SetIssueFieldValue struct {- Issue struct {- ID githubv4.ID- Number githubv4.Int- URL githubv4.String- }- IssueFieldValues []struct {- TextValue struct {- Value string- } `graphql:"... on IssueFieldTextValue"`- SingleSelectValue struct {- Name string- } `graphql:"... on IssueFieldSingleSelectValue"`- DateValue struct {- Value string- } `graphql:"... on IssueFieldDateValue"`- NumberValue struct {- Value float64- } `graphql:"... on IssueFieldNumberValue"`- }- } `graphql:"setIssueFieldValue(input: $input)"`- }{},+ setIssueFieldValueMutation{}, SetIssueFieldValueInput{ IssueID: githubv4.ID("ISSUE_123"), IssueFields: []IssueFieldCreateOrUpdateInput{@@ -2444,9 +2328,8 @@ func TestGranularSetIssueFields(t *testing.T) { githubv4mock.DataResponse(map[string]any{ "setIssueFieldValue": map[string]any{ "issue": map[string]any{- "id": "ISSUE_123",- "number": 5,- "url": "https://github.com/owner/repo/issues/5",+ "id": "ISSUE_123",+ "url": "https://github.com/owner/repo/issues/5", }, }, }),
Outcome
Why this verdict
approve — No checked defect was established by the available proof adapters.
Lens advisories (not part of the checked findings):
- architectural_coherence: A new test uses GraphQL "setIssueFieldValue" mutation with field selection overrides inconsistent with the canonical "SetIssueFieldValues" implementation, which omits field selection in its issued mutation query.
- dependency_blast_radius: The updateProjectItem function calls SetIssueFieldValues, a function called from granular projects tools and projects features, exposing a hidden dependency of project item updates on the setIssueFieldValue capability.
- dependency_blast_radius: Granular issue tools inherit GitHub feature flags propagated through the context (e.g., update_issue_suggestions), causing granular tools to fail or behave unexpectedly when the feature flag is unavailable.
- historical_risk: The file pkg/github/issues_granular.go has occurred 6 times in trajectory data, exceeding the threshold for high-frequency changes, indicating a change hotspot.
- historical_risk: The file pkg/github/issues_granular.go contains 26 code entities (functions, types, test functions) in a single file of 1707 lines, indicating structural complexity accumulation typical of high-frequency change areas.
Lens coverage: 6 delivered
The recorded observations did not become verified findings.
Evidence and perspectives
Observation · Data ConsistencyThe setIssueFieldValue mutation response shape is changed to return only issue{id, url} instead of issue{id, number, url}. Existing callers that read the number field from the response will receive a zero/empty value, causing silent data loss.
Principle · Keep Serialized Contracts Compatible
Recorded location pkg/github/issues_granular.go:1286
Observation · Historical riskThe file pkg/github/issues_granular.go has occurred 6 times in trajectory data, exceeding the threshold for high-frequency changes, indicating a change hotspot.
Recorded location pkg/github/issues_granular.go:1276