Skip to content

fix: add authorAssociation to IssueFragment (GraphQL path)#2265

Open
lanxevo3 wants to merge 1 commit into
github:mainfrom
lanxevo3:main
Open

fix: add authorAssociation to IssueFragment (GraphQL path)#2265
lanxevo3 wants to merge 1 commit into
github:mainfrom
lanxevo3:main

Conversation

@lanxevo3
Copy link
Copy Markdown

Summary

Adds the missing \�uthorAssociation\ field to the \IssueFragment\ GraphQL struct and populates it in \ ragmentToMinimalIssue(), fixing the missing \�uthor_association\ field in \list_issues\ responses when using the GraphQL path.

Changes

  • \pkg/github/issues.go: Added \Author.Association\ field to \IssueFragment\ struct (GraphQL)
  • \pkg/github/minimal_types.go: Set \AuthorAssociation\ in \ ragmentToMinimalIssue()\ from \ ragment.Author.Association\

Note

The REST path (\convertToMinimalIssue()) already correctly sets \AuthorAssociation\ from \issue.GetAuthorAssociation(). The GraphQL path was missing this field.

Fixes #2250

Adds missing authorAssociation field to IssueFragment GraphQL struct
and populates it in fragmentToMinimalIssue(), fixing the missing
author_association field in list_issues responses from the GraphQL path.

The REST path already correctly sets this via convertToMinimalIssue().
Fixes github#2250.
@lanxevo3 lanxevo3 requested a review from a team as a code owner March 26, 2026 20:28
@lanxevo3
Copy link
Copy Markdown
Author

Hey @github/mcp-team — checking in on this PR. It's been open since March 26 and is mergeable. Adds �uthorAssociation field to IssueFragment to fix the GraphQL codegen path. Any blockers or feedback? Happy to iterate.

@SamMorrowDrums
Copy link
Copy Markdown
Collaborator

Hi, I will try to look and get this in soon. It does make sense to provide the data.

Copy link
Copy Markdown
Collaborator

@SamMorrowDrums SamMorrowDrums left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for tackling this @lanxevo3, and apologies for the slow response.

Unfortunately the change as written won't work at runtime — authorAssociation isn't a field on the Actor interface that author returns, it's a top-level field on the Issue node itself. I verified against the live GraphQL API:

$ gh api graphql -f query='{ repository(owner:"github", name:"github-mcp-server") { issues(first:1) { nodes { author { login association } } } } }'
{"errors":[{"message":"Field 'association' doesn't exist on type 'Actor'", ...}]}

vs. the correct shape:

$ gh api graphql -f query='{ repository(owner:"github", name:"github-mcp-server") { issues(first:1) { nodes { authorAssociation author { login } } } } }'
{"data":{"repository":{"issues":{"nodes":[{"authorAssociation":"MEMBER","author":{"login":"toby"}}]}}}}

The unit tests pass because they mock the GraphQL response shape rather than validating against the real schema, so this slipped through.

What needs to change

In pkg/github/issues.go, move the field out of the Author struct and onto IssueFragment itself:

type IssueFragment struct {
    Number            githubv4.Int
    Title             githubv4.String
    Body              githubv4.String
    State             githubv4.String
    DatabaseID        int64
    AuthorAssociation githubv4.String

    Author struct {
        Login githubv4.String
    }
    // ...
}

In pkg/github/minimal_types.go, read the new field directly:

AuthorAssociation: string(fragment.AuthorAssociation),

One more (optional) ask

Issue #2250 also calls out that MinimalPullRequest is missing author_association on the REST path — it'd be great to address that here too while you're at it, but happy to take it as a follow-up if you'd rather keep this PR focused.

Let me know if you'd like me to push the fix on top, otherwise feel free to update and I'll re-review. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing author_association field in list_issues and pull request responses

2 participants